[postgis-commits] svn - r2696 - in branches/gSoC2007_raster/pgraster: . win32 win32/build win32/dep-package win32/dep-package/bin win32/dep-package/example win32/dep-package/include win32/dep-package/lib win32/dep-package/manifest

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Fri Aug 17 15:46:16 PDT 2007


Author: xingkth
Date: 2007-08-17 15:46:15 -0700 (Fri, 17 Aug 2007)
New Revision: 2696

Added:
   branches/gSoC2007_raster/pgraster/linux/
   branches/gSoC2007_raster/pgraster/win32/
   branches/gSoC2007_raster/pgraster/win32/build/
   branches/gSoC2007_raster/pgraster/win32/build/README
   branches/gSoC2007_raster/pgraster/win32/build/UTM2GTIF.TIF
   branches/gSoC2007_raster/pgraster/win32/build/geotiff.dll
   branches/gSoC2007_raster/pgraster/win32/build/geotiff2pgraster.exe
   branches/gSoC2007_raster/pgraster/win32/build/glut32.dll
   branches/gSoC2007_raster/pgraster/win32/build/jpeg62.dll
   branches/gSoC2007_raster/pgraster/win32/build/libimage.dll
   branches/gSoC2007_raster/pgraster/win32/build/libpng13.dll
   branches/gSoC2007_raster/pgraster/win32/build/libtiff.dll
   branches/gSoC2007_raster/pgraster/win32/build/zlib1.dll
   branches/gSoC2007_raster/pgraster/win32/dep-package/
   branches/gSoC2007_raster/pgraster/win32/dep-package/README.txt
   branches/gSoC2007_raster/pgraster/win32/dep-package/bin/
   branches/gSoC2007_raster/pgraster/win32/dep-package/bin/geotiff.dll
   branches/gSoC2007_raster/pgraster/win32/dep-package/bin/glut32.dll
   branches/gSoC2007_raster/pgraster/win32/dep-package/bin/jpeg62.dll
   branches/gSoC2007_raster/pgraster/win32/dep-package/bin/libimage.dll
   branches/gSoC2007_raster/pgraster/win32/dep-package/bin/libpng13.dll
   branches/gSoC2007_raster/pgraster/win32/dep-package/bin/libtiff.dll
   branches/gSoC2007_raster/pgraster/win32/dep-package/bin/zlib1.dll
   branches/gSoC2007_raster/pgraster/win32/dep-package/example/
   branches/gSoC2007_raster/pgraster/win32/dep-package/example/build.bat
   branches/gSoC2007_raster/pgraster/win32/dep-package/example/listgeo.c
   branches/gSoC2007_raster/pgraster/win32/dep-package/example/listgeo.exe
   branches/gSoC2007_raster/pgraster/win32/dep-package/example/listgeo.obj
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/cpl_serv.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/defs.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_datum.inc
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_ellipse.inc
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_gcs.inc
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_pcs.inc
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_pm.inc
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_proj.inc
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_units.inc
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_vertcs.inc
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_config.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_ctrans.inc
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_keyp.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_normalize.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_tiffp.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/geokeys.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/geokeys.inc
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/geonames.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/geotiff.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/geotiffio.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/geovalues.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/port.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/t4.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_dir.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_fax3.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_predict.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiff.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffcomp.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffconf.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffio.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffiop.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffvers.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/uvcode.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/include/xtiffio.h
   branches/gSoC2007_raster/pgraster/win32/dep-package/lib/
   branches/gSoC2007_raster/pgraster/win32/dep-package/lib/geotiff_i.lib
   branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff-bcc.lib
   branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff.def
   branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff.dll.a
   branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff.lib
   branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff_i.lib
   branches/gSoC2007_raster/pgraster/win32/dep-package/manifest/
   branches/gSoC2007_raster/pgraster/win32/dep-package/manifest/tiff-3.8.2-1-lib.mft
   branches/gSoC2007_raster/pgraster/win32/dep-package/manifest/tiff-3.8.2-1-lib.ver
Modified:
   branches/gSoC2007_raster/pgraster/Makefile
   branches/gSoC2007_raster/pgraster/geotiff2pgraster.c
   branches/gSoC2007_raster/pgraster/pgraster.sql
   branches/gSoC2007_raster/pgraster/pgraster_const.h
   branches/gSoC2007_raster/pgraster/pgraster_types.h
   branches/gSoC2007_raster/pgraster/pgraster_utils.c
   branches/gSoC2007_raster/pgraster/pgraster_utils.h
   branches/gSoC2007_raster/pgraster/wkb.c
   branches/gSoC2007_raster/pgraster/wkb.h
Log:
xinglin:ver.0.1 geotiff2pgraster and its win32 build

Modified: branches/gSoC2007_raster/pgraster/Makefile
===================================================================
--- branches/gSoC2007_raster/pgraster/Makefile	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/Makefile	2007-08-17 22:46:15 UTC (rev 2696)
@@ -10,6 +10,13 @@
 
 OBJS = pgraster_utils.o getopt.o wkb.o
 
+prefix = /usr
+libdir  = ${prefix}/lib/
+libdir2  = ${prefix}/bin/
+includedir = ${prefix}/include
+
+LIBS=  -L$(libdir2) -lgeotiff -L$(libdir2) -ltiff -L.
+
 #---------------------------------------------------------------
 
 ifeq ($(USE_ICONV),1)
@@ -22,16 +29,16 @@
 all: geotiff2pgraster$(EXE) pgraster2geotiff$(EXE) 
 
 geotiff2pgraster.o: geotiff2pgraster.c
-	$(CC) $(CFLAGS) $(PGFEINCLUDES) -c $<
+	$(CC) $(CFLAGS) $(PGFEINCLUDES) -I${includedir} -c $<
 
 pgraster2geotiff.o: pgraster2geotiff.c
-	$(CC) $(CFLAGS) $(PGFEINCLUDES) -c $<
+	$(CC) $(CFLAGS) $(PGFEINCLUDES) -I${includedir} -c $<
 
-geotiff2pgraster$(EXE): $(OBJS) geotiff2pgraster.o
-	$(CC) $(CFLAGS) $(OBJS) geotiff2pgraster.o $(LDFLAGS) $(PGFELIBS) -o $@ 
+geotiff2pgraster$(EXE): $(OBJS) geotiff2pgraster.o 
+	$(CC) $(CFLAGS) $(OBJS) geotiff2pgraster.o $(LDFLAGS) $(PGFELIBS) ${LIBS} -o $@ 
 
 pgraster2geotiff$(EXE): $(OBJS) pgraster2geotiff.o
-	$(CC) $(CFLAGS) $(OBJS) pgraster2geotiff.o $(LDFLAGS) $(PGFELIBS) -o $@  
+	$(CC) $(CFLAGS) $(OBJS) pgraster2geotiff.o $(LDFLAGS) $(PGFELIBS) ${LIBS} -o $@  
 
 install: all
 	@mkdir -p $(DESTDIR)$(bindir)

Modified: branches/gSoC2007_raster/pgraster/geotiff2pgraster.c
===================================================================
--- branches/gSoC2007_raster/pgraster/geotiff2pgraster.c	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/geotiff2pgraster.c	2007-08-17 22:46:15 UTC (rev 2696)
@@ -28,11 +28,17 @@
  *
  * Last Update: 	2007-07-22
  *
+ * Change Log: 
+ * (1) 2007-07-22   CREATED (Xing)
+ * (2) 2007-07-22 	Main part of functions (Xing)
+ * (3) 2007-07-30  	Finish GeoTIFF loader into GeoTIFF. (Xing)
+ *
  **********************************************************************/
 
 static char rcsid[] =
   "$Id: geotiff2pgraster.c 2007-07-22 Xing.Lin $";
 
+#include "../config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -42,6 +48,16 @@
 /* Solaris9 does not provide stdint.h */
 /* #include <stdint.h> */
 #include <inttypes.h>
+
+//GeoTIFF & TIFF library headers
+#include "geotiff.h"
+#include "xtiffio.h"
+#include "tiffiop.h"
+#include "geo_normalize.h"
+#include "geovalues.h"
+#include "tiffio.h"
+
+//Libpq & PGRaster headers
 #include "libpq-fe.h"
 #include "getopt.h"
 #include "pgraster_const.h"
@@ -63,30 +79,83 @@
 #endif
 
 /* Debug Control Flag */
-/* #define DEBUG 1 */
+//#define DEBUG 1
 
-/*
- * Verbosity:
- *   set to 1 to see record fetching progress
- *   set to 2 to see also shapefile creation progress
- *   set to 3 for debugging
- */
 #define VERBOSE 1
 
+/* Buffer length for SQL statement */
+#define QUERY_BUF_LENGTH 1024
+
 /* Global data */
 PGconn *conn;
 PGresult *res;
+TIFF 	*tif=(TIFF*)0;  /* TIFF-level descriptor */
+GTIF	*gtif=(GTIF*)0; /* GeoKey-level descriptor */
 int rowbuflen;
-char *table, *geotiff_file, *schema, *geotiff_filename;
+char *table, *geotiff_file, *schema, *geotiff_filename, *insertStmt;
 int keep_fieldname_case = 0;
 int big_endian = 0;
 int pgis_major_version;
+#define MODE_QUIET 0
+#define MODE_NORMAL 1
+#define MODE_VERBOSE 2
+int outmode = 1; // 0=quiet mode;  1=normal mode, 2=verbose mode.
+bool beginTransaction = FALSE;
 char *PG_VERSION = "8.2.4\0";
 PGRasterMetadata metadata;
 #ifdef USE_ICONV
 char	*encoding=NULL;
 #endif
 
+/* TIFF Reader Global Data */
+byte *pDataBuffer = NULL;
+short scanlineMode = 0;
+int nTIFFBytePerPixel = 0;
+int nTIFFBitsPerPixel = 0;
+int nRealBytePerPixel = 0;
+int nRealBitsPerPixel = 0;
+uint32 stripMax, stripCount;
+tsize_t stripSize;
+uint32 bufferSize;
+unsigned long imageOffset;
+double dblNoDataValue = -1.0f;
+uint16 bps       = 1;
+uint16 spp       = 1;
+uint16 mode      = PHOTOMETRIC_MINISBLACK;
+uint16 format    = SAMPLEFORMAT_UINT;
+uint16 planar    = PLANARCONFIG_CONTIG;
+uint16 preMultiplied = 0;
+uint16 fillorder = 0 ;
+byte tiff_bigendian = 0; // whether TIFF file uses big endian byte order.
+byte badIndians = 0; // whether TIFFBigEndian != big_endian
+byte hasAlpha = 0; // hasAlpha channel???
+uint32 rows = 0; // number of TIFF image rows
+uint32 cols = 0; // number of TIFF image column
+uint32 bands = 0; // number of raster bands (image channel)
+uint32 nPyramidDepth = 0; // pyramide depth.
+
+/*
+// If the data buffer is smaller than whole image
+// we need such variables to navigate through the buffer.
+unsigned char* scanlineBuffer = NULL;
+unsigned char* decompressed = NULL;
+uint32 curRow = 0;
+uint32 curCol = 0; 
+uint32 curMinRow = 0;
+uint32 curMaxRow = 0;
+uint32 curMinCol = 0;
+uint32 curMaxCol = 0;
+*/
+
+// variables for TIFF transformation CIE to RGB .
+static float   refWhite[3];
+static TIFFCIELabToRGB* cielab = 0;
+
+
+#ifdef DEBUG
+	FILE *debug;
+#endif
+
 /* Prototypes */
 char * getTableOID(char *schema, char *table);
 void usage(char* me, int status, FILE* out);
@@ -99,12 +168,29 @@
 
 /* Functions for Data Loading */
 
+/* Step 0. Parse Paramaters and Create Connection*/
+void ParseAndCreateConnection(int ARGC, char **ARGV);
+
 /* Step 1. Initialization*/
 void Initialization();
 
+void _ReadGeoTIFFHeader();
+
+void _PreInsertMetadata();
+
+void _CleanUpDemo();
+
 /* Step 2. LoadData */
 void LoadData();
 
+int _BeginReadTIFF();
+
+void _initCIELabConversion(TIFF* pTif);
+
+void _EndReadTIFF();
+
+byte* _GetTIFFAt(int row, int col, int band, int *bytereturned);
+
 /* Step 3. CreateIndex() */
 void CreateIndex();
 
@@ -128,8 +214,9 @@
 {
 	void *ret = malloc(size);
 	if ( ! ret ) {
-		fprintf(stderr, "Out of virtual memory\n");
-		exit(1);
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "**Error**: Out of virtual memory\n");
+		exit_nicely(conn, 1);
 	}
 	return ret;
 }
@@ -140,52 +227,9 @@
 /* Main Programe */
 int main(int ARGC, char **ARGV)
 {
-	/* Definition and Initialization for local/global variables */
-	int 		row;
-	char		buf[256];
+	/* Step 0. Parse Paramaters and Create Connection */
+	ParseAndCreateConnection(ARGC, ARGV);
 
-	geotiff_file = NULL;
-	table = NULL;
-	schema = NULL;
-	geotiff_filename = NULL;
-	rowbuflen=100;
-	keep_fieldname_case = 0;
-	conn = NULL;
-	res = NULL;
-
-	// Initialize PGRasterMetadata Structure
-	initialize_metadata(&metadata);
-
-#ifdef DEBUG
-	FILE *debug;
-#endif
-
-	if ( getenv("ROWBUFLEN") ) rowbuflen=atoi(getenv("ROWBUFLEN"));
-	/*
-	 * Make sure dates are returned in ISO
-	 * style (YYYY-MM-DD).
-	 * This is to allow goodDBFValue() function 
-	 * to successfully extract YYYYMMDD format
-	 * expected in shapefile's dbf file.
-	 */
-	putenv("PGDATESTYLE=ISO");
-
-	if ( ! parse_commandline(ARGC, ARGV) ) {
-                printf("\n**ERROR** invalid option or command parameters\n\n");
-		usage(ARGV[0], 2, stderr);
-	}
-
-#ifdef DEBUG
-	if(	getenv("PGHOST") != NULL && getenv("PGUSER") != NULL && 
-		getenv("PGPORT") != NULL && getenv("PGDATABASE") != NULL && 
-		getenv("PGPASSWORD") != NULL
-		)
-		printf("PGHOST=%s PGPORT=%s PGDATABASE=%s PGUSER=%s PGPASSWORD=%s\n",
-				getenv("PGHOST"), getenv("PGPORT"), getenv("PGDATABASE"),
-				getenv("PGUSER"), getenv("PGPASSWORD"));
-	printf("SCHEMA=%s TABLE=%s geotiff_file=%s geotiff_filename=%s\n",schema,table,geotiff_file,geotiff_filename);
-#endif
-
 	/* Step 1. Initialization & Create PreparedStatement for Data Insert*/
 	Initialization();
 
@@ -207,11 +251,10 @@
 	/* Step 6. Function Successfully Return and Send Message To Terminal or Log */
 	PrintResultMessage();
 
-	return 1;
+	return 0;
 }
 
 /******** Implementation of Functions ********/
-
 /* 
  * Return allocate memory. Free after use.
  */
@@ -230,25 +273,30 @@
 	if ( schema )
 	{
 		sprintf(query, "SELECT oid FROM pg_class c, pg_namespace n WHERE c.relnamespace n.oid AND n.nspname = '%s' AND c.relname = '%s'", schema, table);
-	} else {
+	} 
+	else 
+	{
 		sprintf(query, "SELECT oid FROM pg_class WHERE relname = '%s'", table);
 	}
 
 	res3 = PQexec(conn, query);
 	free(query);
 	if ( ! res3 || PQresultStatus(res3) != PGRES_TUPLES_OK ) {
-		printf( "TableOID: %s", PQerrorMessage(conn));
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "**Error** when getting TableOID: %s", PQerrorMessage(conn));
 		exit_nicely(conn, 1);
 	}
 	if(PQntuples(res3) == 1 ){
 		ret = strdup(PQgetvalue(res3, 0, 0));
 	}else if(PQntuples(res3) == 0 ){
-		printf( "Cannot find relation OID (does table exist?).\n");
+		if(outmode != MODE_QUIET)
+			fprintf(stdout, "Cannot find relation OID (does table exist?).\n");
 		PQclear(res3);
 		return NULL;
 	}else{
 		ret = strdup(PQgetvalue(res3, 0, 0));
-		printf( "Warning: Multiple relations detected, the program will only dump the first relation.\n");
+		if(outmode != MODE_QUIET)
+			printf( "Warning: Multiple relations detected, the program will only dump the first relation.\n");
 	}	
 	PQclear(res3);
 	return ret;
@@ -257,8 +305,7 @@
 /*
  * Print the usage information to standard output destination (terminal, file or so on).
  */
-void
-usage(char* me, int status, FILE* out)
+void usage(char* me, int status, FILE* out)
 {
     fprintf(out,"PostgreSQL Version: %s \\ PostGIS Version: %s\n", PG_VERSION, POSTGIS_VERSION);
 	fprintf(out,"RCSID: %s RELEASE: %s\n", rcsid, PGRASTER_VERSION);
@@ -268,39 +315,7 @@
 	fprintf(out,"\n");
 
 	fprintf(out,"OPTIONS:\n");
-    
-	fprintf(out,"#######################  (NOT SUPPORTED YET)  #########################\n");
-    
-	fprintf(out,"(Note that -a, -c, -d and -p are mutually exclusive.)\n");	
-
-	fprintf(out," -d  Drops the database table before creating a new  table  with  the\n");
-    fprintf(out,"     data in the geotiff file.\n");
-
-	fprintf(out," -a  Appends  data  from the geotiff file into the existing database\n");
-    fprintf(out,"     table. Although it is not recommended to store raw data of sever-\n");
-	fprintf(out,"     ral raster dataset into one raster data table (sharing). But if\n");
-	fprintf(out,"     you insist, you can do it by this option\n");
-
-	fprintf(out," -c  Creates a new table and populates it from the geotiff file. This\n");
-    fprintf(out,"     is the default mode.\n");
-
-
-	fprintf(out," -p  Only produces the table creation SQL code,  without  adding  any\n");
-    fprintf(out,"     actual data. This can be used if you need to completely seperate\n");
-	fprintf(out,"     the table creation and data loading steps.\n");
-	fprintf(out,"     (NOT SUPPORTED YET)\n");
-	
-	fprintf(out," -D  Use the PostgreSQL \"dump\" format for the output data.  This  can\n");
-    fprintf(out,"     be  combined  with -a, -c and -d. It is much faster to load than\n");
-	fprintf(out,"     the default \"insert\" SQL format. Use this for  very  large  data\n");
-	fprintf(out,"     sets. If this option is set, then the following options could be\n");
-	fprintf(out,"     ignored.\n");
-	fprintf(out,"     (NOT SUPPORTED YET)\n");
-
-	fprintf(out,"#######################  (NOT SUPPORTED YET)  #########################\n");
-    
-	fprintf(out,"\n");
-
+   
 	fprintf(out," -h <host>\n");
 	fprintf(out,"     The database host to connect to. If ignored, the default address\n");
     fprintf(out,"     of host will be \"localhost/127.0.0.1\". If no database running on\n");
@@ -332,8 +347,46 @@
 	fprintf(out," -k  			Keep postgresql identifiers case.\n");
     fprintf(out," -?/--help 	Display this help screen.\n");
 
+	fprintf(out," -q  Load data in quiet mode.\n");
+
+	fprintf(out," -v  Load data in verbose mode.\n");
+
     fprintf(out,"\n");
+
+	fprintf(out,"(Note that -a, -c, -d and -p are mutually exclusive.)\n");	
+
+	fprintf(out,"#######################  (NOT SUPPORTED YET)  #########################\n");
     
+	fprintf(out,"(Note that -a, -c, -d and -p are mutually exclusive.)\n");	
+
+	fprintf(out," -d  Drops the database table before creating a new  table  with  the\n");
+    fprintf(out,"     data in the geotiff file.\n");
+
+	fprintf(out," -a  Appends  data  from the geotiff file into the existing database\n");
+    fprintf(out,"     table. Although it is not recommended to store raw data of sever-\n");
+	fprintf(out,"     ral raster dataset into one raster data table (sharing). But if\n");
+	fprintf(out,"     you insist, you can do it by this option\n");
+
+	fprintf(out," -c  Creates a new table and populates it from the geotiff file. This\n");
+    fprintf(out,"     is the default mode.\n");
+
+
+	fprintf(out," -p  Only produces the table creation SQL code,  without  adding  any\n");
+    fprintf(out,"     actual data. This can be used if you need to completely seperate\n");
+	fprintf(out,"     the table creation and data loading steps.\n");
+	fprintf(out,"     (NOT SUPPORTED YET)\n");
+	
+	fprintf(out," -D  Use the PostgreSQL \"dump\" format for the output data.  This  can\n");
+    fprintf(out,"     be  combined  with -a, -c and -d. It is much faster to load than\n");
+	fprintf(out,"     the default \"insert\" SQL format. Use this for  very  large  data\n");
+	fprintf(out,"     sets. If this option is set, then the following options could be\n");
+	fprintf(out,"     ignored.\n");
+	fprintf(out,"     (NOT SUPPORTED YET)\n");
+
+	fprintf(out,"#######################  (NOT SUPPORTED YET)  #########################\n");
+    
+	fprintf(out,"\n");
+
 	exit (status);
 }
 
@@ -345,12 +398,12 @@
     }
 
 	int c, curindex;
-	char buf[1024];
+	char buf[QUERY_BUF_LENGTH];
 
-	buf[1023] = '\0'; 
+	memset(buf,QUERY_BUF_LENGTH, '\0'); 
 
 	/* Parse command line */
-    while ((c = getopt(ARGC, ARGV, "h:d:U:p:P:rk")) != EOF){
+    while ((c = getopt(ARGC, ARGV, "h:d:U:p:P:rk:vq")) != EOF){
 		switch (c) {
 			case 'h':
 				/*setenv("PGHOST", optarg, 1); */
@@ -376,7 +429,13 @@
 				/*setenv("PGPASSWORD", optarg, 1); */
 				snprintf(buf, 255, "PGPASSWORD=%s", optarg);
 				putenv(strdup(buf));
-				break;			
+				break;
+			case 'v': // verbose mode
+				outmode = MODE_VERBOSE;
+				break;
+			case 'q': // quiet mode
+				outmode = MODE_QUIET;
+				break;
 			case 'k':
 				keep_fieldname_case = 1;
 				break;
@@ -432,7 +491,6 @@
 			*ptr = '\0';
 			schema = table;
 			table = ptr+1; 
-			//Do it need to add '\0' after the input spec???
 	}
 }
 
@@ -440,6 +498,7 @@
  * Parse the filename from geotiff_file path. Typical geotiff_file looks like:
  * 1) /home/pgraster/data/usa_tm1990.tif
  * 2) usa_tm1990.tif
+ * XXX: "Windows \" vs "Linux/Unix /"
  */
 static void parse_geotiffname(char *spec)
 {
@@ -462,7 +521,7 @@
 	{
 			*ptr = '\0';
 			if( (ptr=strrchr(strTemp,92)) || (ptr=strrchr(strTemp,'/')) ) 
-				// how to deal with '/' and '\' different OS.
+				//XXX: how to deal with '/' and '\' different OS.
 			{
 				ptr = ptr+1;
 				nlen2 = strlen(ptr);
@@ -477,6 +536,11 @@
 				geotiff_filename = strcpy(geotiff_filename, ptr);
 			}
 	}
+	else
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "**Error**: Fail to parse GeoTIFF dataset name from file %s\n", geotiff_file);
+	}
 }
 
 /*
@@ -484,6 +548,17 @@
  */
 static void exit_nicely(PGconn *conn, int code)
 {
+	if(beginTransaction == TRUE)
+	{
+		res = PQexec(conn, "ROLLBACK");
+		PQclear(res);
+	}
+
+	/* Close GeoTIFF File */
+	if (gtif) GTIFFree(gtif);
+    if (tif) XTIFFClose(tif); 
+
+	/* Close PGConnection*/
 	PQfinish(conn);
 	exit(code);
 }
@@ -496,13 +571,16 @@
 	PGresult *res;
 	char *version;
 	int ver;
-	char query[] = "SELECT postgis_version()";
+	char *query = "SELECT postgis_version()";
 	res = PQexec(conn, query);
 
-	if ( ! res || PQresultStatus(res) != PGRES_TUPLES_OK ) {
-		printf( "Can't detect postgis version:\n");
-		printf( "PostgisVersionQuery: %s",
-			PQerrorMessage(conn));
+	if ( ! res || PQresultStatus(res) != PGRES_TUPLES_OK ) 
+	{
+		if(outmode != MODE_QUIET)
+		{
+			fprintf(stderr, "**Error**: Can't detect postgis version:\n");
+			fprintf(stderr, "**Error**: PostgisVersionQuery: %s", PQerrorMessage(conn));
+		}
 		exit(1);
 	}
 
@@ -523,10 +601,13 @@
 	char query[] = "SELECT pgraster_version()";
 	res = PQexec(conn, query);
 
-	if ( ! res || PQresultStatus(res) != PGRES_TUPLES_OK ) {
-		printf( "Can't detect postgis version:\n");
-		printf( "PostgisVersionQuery: %s",
-			PQerrorMessage(conn));
+	if ( ! res || PQresultStatus(res) != PGRES_TUPLES_OK ) 
+	{
+		if(outmode != MODE_QUIET)
+		{
+			fprintf(stderr, "**Error**: Can't detect PGRaster version:\n");
+			fprintf(stderr, "**Error**: PGRaster Version Query: %s", PQerrorMessage(conn));
+		}
 		exit(1);
 	}
 
@@ -536,23 +617,6 @@
 	return ver;
 }
 
-/*
- * Initialization - Create table and prepare metadata information for import.
- *
- * (To Be Finished...)
- *
- */
-int Initialize(void)
-{
-
-	PGresult *res;
-
-	res = NULL;
-
-	return 0;
-}
-
-
 /* make_good_string from shp_loader*/
 char * make_good_string(char *str)
 {
@@ -663,31 +727,578 @@
 	return result;
 }
 
-/* Functions for Data Loading */
+/********************************************************************/
+/******************** Functions for Data Loading ********************/
+/********************************************************************/
 
+void ParseAndCreateConnection(int ARGC, char **ARGV)
+{
+	
+	/* Definition and Initialization for local/global variables */
+	big_endian = is_bigendian();
+
+	geotiff_file = NULL;
+	table = NULL;
+	schema = NULL;
+	geotiff_filename = NULL;
+	rowbuflen=100;
+	keep_fieldname_case = 0;
+	conn = NULL;
+	res = NULL;
+	insertStmt = NULL;
+
+	if ( getenv("ROWBUFLEN") ) rowbuflen=atoi(getenv("ROWBUFLEN"));
+	/*
+	 * Make sure dates are returned in ISO
+	 * style (YYYY-MM-DD).
+	 * This is to allow goodDBFValue() function 
+	 * to successfully extract YYYYMMDD format
+	 * expected in shapefile's dbf file.
+	 */
+	putenv("PGDATESTYLE=ISO");
+
+	if ( ! parse_commandline(ARGC, ARGV) ) 
+	{
+		if(outmode != MODE_QUIET)
+		{	fprintf(stderr, "**ERROR** invalid option or command parameters.\n");
+			usage(ARGV[0], 2, stderr);
+		}
+		
+		exit_nicely(conn,1);
+	}
+
+#ifdef DEBUG
+	if(	getenv("PGHOST") != NULL && getenv("PGUSER") != NULL && 
+		getenv("PGPORT") != NULL && getenv("PGDATABASE") != NULL && 
+		getenv("PGPASSWORD") != NULL
+		)
+		fprintf(stdout, "PGHOST=%s PGPORT=%s PGDATABASE=%s PGUSER=%s PGPASSWORD=%s\n",
+				getenv("PGHOST"), getenv("PGPORT"), getenv("PGDATABASE"),
+				getenv("PGUSER"), getenv("PGPASSWORD"));
+	fprintf(stdout, "SCHEMA=%s TABLE=%s geotiff_file=%s geotiff_filename=%s\n",schema,table,geotiff_file,geotiff_filename);
+#endif
+	
+	if(outmode != MODE_QUIET)
+	{
+		fprintf(stdout, "From GeoTIFF:\n\tgeotiff_file=%s geotiff_filename=%s\n",  geotiff_file,geotiff_filename);
+		fprintf(stdout, "To PostgreSQL:\n\t host=%s PGPORT=%s database=%s user=%s password=%s schema=%s table=%s \n",
+				getenv("PGHOST"), getenv("PGPORT"), getenv("PGDATABASE"),
+				getenv("PGUSER"), getenv("PGPASSWORD"),schema,table);
+	}
+
+}
+
+
 /* Step 1. Initialization*/
 void Initialization()
 {
 	/* Declare local variable */
-	char* metaInsert = NULL;
-	
+	char query[QUERY_BUF_LENGTH]; 
+	bool bResult = FALSE;
+
+	if(outmode == MODE_VERBOSE)
+	{
+ 		fprintf(stdout, "Start initializing data load for GeoTIFF......\n");
+	}
+
+	// Initialize PGRasterMetadata object
+	initialize_metadata(&metadata);
+
 	/* Make a connection to the specified database, and exit on failure */
 	// All the necessary information is stored in OS Env-Variables
 	conn = PQconnectdb("");
-	if (PQstatus(conn) == CONNECTION_BAD) {
-		printf( "%s", PQerrorMessage(conn));
+	if (PQstatus(conn) != CONNECTION_OK) 
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "**Error**: when making connection to PostgreSQL: %s", PQerrorMessage(conn));
 		exit_nicely(conn, 1);
 	}
 
 #ifdef DEBUG
-	debug = fopen("/tmp/geotiff2pgraster.log", "w");
+	printf("Connection OK!");
+	debug = fopen("geotiff2pgraster.log", "wt");
 	PQtrace(conn, debug);
 #endif	 /* DEBUG */
 
+#ifdef DEBUG
+	_CleanUpDemo();
+#endif
+
 	/*
-	 * Begin the transaction
-	 * (a cursor can only be defined inside a transaction block)
+	 * Check Input Schema & Table Valid for Insert???
 	 */
+	sprintf(query, "SELECT CheckRasterValidity('%s','%s')", schema, table); 
+
+#ifdef DEBUG
+	printf("Query=%s\n", query);
+#endif
+
+
+ 	res = PQexecParams(conn,
+                       query,
+                       0,       
+                       NULL,    
+                       NULL,
+                       NULL,
+                       NULL,
+                       1);      /* ask for binary results */
+
+ 	if (PQresultStatus(res) != PGRES_TUPLES_OK)
+  	{
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "**Error** when check raster name validity: %s", PQerrorMessage(conn));
+        PQclear(res);
+        exit_nicely(conn,1);
+  	}	
+	else
+	{
+		bResult = ((byte*)PQgetvalue(res,0,0))[0];
+		PQclear(res);
+	}
+
+	if(bResult == FALSE)
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stdout, "Current schema & table name exist. Please try again using a different pair.");
+		exit_nicely(conn, 1);
+	}
+	else
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stdout, "GeoTIFF Schema & Name OK. \n");
+	}
+
+	/*
+	 * Read metadata from GeoTIFF file using libgeotiff & libtiff
+	 *                         & 
+	 * PreInsert the metdata and generate a new object id
+	 */
+	_ReadGeoTIFFHeader();
+
+	
+	/*
+	 * Insert metadata into metadata table. 
+	 * It will be updated after finishing data insertion.
+	 */
+	_PreInsertMetadata();
+
+	if(outmode == MODE_VERBOSE)
+	{
+ 		fprintf(stdout, "Finish data loader initializaiton.\n");
+	}
+
+}
+
+void _ReadGeoTIFFHeader()
+{
+	/*
+     * Open the file, read the GeoTIFF information 
+     */
+	short Model = -1;
+	short RasterModel = -1; // Area or Point
+	int SRID = -1;
+	double xGeoResolution = 0.0;
+	double yGeoResolution = 0.0;
+	double zGeoResolution = 0.0;
+	double xCoordMax = 0.0;
+	double yCoordMax = 0.0;
+	double xCoordMin = 0.0;
+	double yCoordMin = 0.0;
+	PGRasterDataType datatype = DT_UNKNOWN;
+	PGRasterBandType bandtype = BT_UNKNOWN;
+	PGRasterValueType valuetype = VT_IMAGE; 	
+
+	if(outmode == MODE_VERBOSE)
+	{
+ 		fprintf(stdout, "Start reading GeoTIFF & TIFF metadata......\n");
+	}
+
+	//Use GeoTIFF & TIFF to Open and Read Header Information.
+    tif=XTIFFOpen(geotiff_file,"r");
+    if (!tif)
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "**Error**: when openning TIFF files.\n");
+		exit_nicely(conn, 1);
+	}
+	
+    gtif = GTIFNew(tif);
+    if (!gtif)
+    {
+        if(outmode != MODE_QUIET)
+			fprintf(stderr,"**Error**: failed to open GeoTIFF object.\n");
+        exit_nicely(conn, 1);
+	}
+
+	//Read Image Metdata Data 
+	{
+		uint16 tif_magic;
+		FILE* ftifftemp = fopen(geotiff_file, "r");
+		// Judge TIFF Endian??		
+		if(ftifftemp == NULL)
+		{
+			if(outmode != MODE_QUIET)
+				fprintf(stderr, "**Error** when open another instance of TIFF file\n");
+			exit_nicely(conn, 1);
+		}
+		fseek(ftifftemp,0,SEEK_SET);
+		fread(&tif_magic,sizeof(tif_magic),1, ftifftemp);
+		if( tif_magic == TIFF_BIGENDIAN)
+			tiff_bigendian = 1;
+		else 
+			tiff_bigendian = 0;
+		fclose(ftifftemp);
+		ftifftemp = NULL;
+
+		if(tiff_bigendian != big_endian)
+			badIndians = 1;
+		else
+			badIndians = 0;
+
+		//Read TIFF Header Data
+		TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE,   &bps);
+		TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &spp);
+    	TIFFGetField(tif, TIFFTAG_PHOTOMETRIC,     &mode);
+   	 	TIFFGetField(tif, TIFFTAG_SAMPLEFORMAT,    &format);
+    	TIFFGetField(tif, TIFFTAG_PLANARCONFIG,    &planar);
+		TIFFGetField(tif, TIFFTAG_MATTEING,        &preMultiplied);
+		TIFFGetField(tif, TIFFTAG_FILLORDER, 	   &fillorder);
+		TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, 	   &cols);
+    	TIFFGetField(tif, TIFFTAG_IMAGELENGTH,     &rows);
+
+		//Calculate nTIFFBytePerPixel (Not so simple) 
+		nTIFFBytePerPixel = bps*spp/8;
+		nTIFFBitsPerPixel = bps*spp;
+		
+		if(bps == 1 && (mode == PHOTOMETRIC_MINISBLACK || mode == PHOTOMETRIC_MINISWHITE)) 
+		{
+			//Black and White
+			datatype = DT_1BIT;	
+			if(spp > 1)
+			{
+				bandtype = BT_MULTI;
+				valuetype = VT_IMAGE;
+			}
+			else
+			{
+				bandtype = BT_SINGLE;
+				valuetype = VT_NOMINAL;
+			}
+			bands = spp;
+			nRealBytePerPixel = -8;
+			nRealBitsPerPixel = bps*bands;
+			
+		}
+		else if(mode == PHOTOMETRIC_RGB)
+		{
+			bands = 1;
+			bandtype = BT_SINGLE;
+			valuetype = VT_IMAGE;
+			if(spp == 3) // RGB
+			{
+				bandtype = BT_RGB;
+				datatype = DT_24BIT_RGB;
+			}
+			else
+			{
+				bandtype = BT_RGBA;
+				datatype = DT_32BIT_RGBA;
+			}
+
+			nRealBytePerPixel = spp;
+			nRealBitsPerPixel = spp * 8;
+
+		}
+		else if(mode == PHOTOMETRIC_CIELAB || mode == PHOTOMETRIC_PALETTE)
+		{
+			//GeoTIFF RGA or CYK mode
+			bands = 1;
+			bandtype = BT_SINGLE;
+			valuetype = VT_IMAGE;
+			bandtype = BT_RGB;
+			datatype = DT_24BIT_RGB;
+			nRealBytePerPixel = 3;
+			nRealBytePerPixel = 8 * nRealBytePerPixel;
+		}
+		else
+		{
+			// Determind by format.
+			bands = spp;
+			if(spp > 1)
+				bandtype = BT_MULTI;
+			else 
+				bandtype = BT_SINGLE;
+
+			nRealBitsPerPixel = bps*spp;
+
+			if(bps < 8)
+			{
+				nRealBytePerPixel = (-1) * bps;
+			}
+			else
+				nRealBytePerPixel = bps / 8;
+
+			valuetype = VT_RATIO;	
+
+			switch (format) 
+			{
+				case SAMPLEFORMAT_VOID:
+				{
+					if(bps == 8)
+						datatype = DT_8BIT_U;
+					else if(bps == 16)
+						datatype = DT_16BIT_U;
+					else if(bps == 32)
+						datatype = DT_32BIT_REAL;
+					else if(bps == 64)
+						datatype = DT_64BIT_REAL;
+					else
+					{
+						if(outmode != MODE_QUIET)
+							fprintf(stderr , "**Error**: Unsupported TIFF sample format.\n");
+						exit_nicely(conn,1);
+					}
+					break;
+				}
+				case SAMPLEFORMAT_INT:
+				{
+					if(bps == 8)
+						datatype = DT_8BIT_S;
+					else if(bps == 16)
+						datatype = DT_16BIT_S;
+					else if(bps == 32)
+						datatype = DT_32BIT_S;
+					else
+					{
+						if(outmode != MODE_QUIET)
+							fprintf(stderr , "**Error**: Unsupported TIFF sample format.\n");
+						exit_nicely(conn,1);
+					}
+					break;
+				}
+				case SAMPLEFORMAT_UINT:
+				{
+					if(bps == 8)
+						datatype = DT_8BIT_U;
+					else if(bps == 16)
+						datatype = DT_16BIT_U;
+					else if(bps == 32)
+						datatype = DT_32BIT_U;
+					else
+					{
+						if(outmode != MODE_QUIET)
+							fprintf(stderr , "**Error**: Unsupported TIFF sample format.\n");
+						exit_nicely(conn,1);
+					}
+					break;
+				}
+				case SAMPLEFORMAT_IEEEFP:
+				{
+					if(bps != 32)
+					{
+						if(outmode != MODE_QUIET)
+							fprintf(stderr , "**Error**: Unsupported TIFF sample format.\n");
+						exit_nicely(conn,1);
+					}
+					else 
+					{
+						datatype = DT_32BIT_REAL;			
+					}
+					break;
+				}
+				case SAMPLEFORMAT_COMPLEXINT:
+				case SAMPLEFORMAT_COMPLEXIEEEFP:
+				default:
+				{	
+					if(outmode != MODE_QUIET)
+						fprintf(stderr , "**Error**: Unsupported TIFF sample format.\n");
+					exit_nicely(conn,1);
+				}
+			}
+
+		}
+		
+	}
+
+	//Start Reading Geo-Metedata Data
+	{
+	 	GTIFDefn	defn; 		
+        
+		GTIFKeyGet( gtif, GTRasterTypeGeoKey, (void*)&RasterModel, 
+                      	0, 1 );
+		
+#ifdef DEBUG
+		if(RasterModel == RasterPixelIsArea)
+		{
+			printf("RasterModel : RasterPixelIsArea = %d\n", RasterModel);
+		}
+		else if(RasterModel == RasterPixelIsPoint)
+		{
+			printf("RasterModel: RasterPixelIsPoint = %d\n", RasterModel);
+		}
+#endif
+
+		if( GTIFGetDefn( gtif, &defn ) )        
+		{
+			Model = defn.Model;
+
+			SRID = defn.PCS;
+			
+			//Get MBR in PCS / GCS
+			xCoordMax = cols;
+			xCoordMin = 0.0;
+			yCoordMax = 0.0;
+			yCoordMin = rows;
+
+			if( !GTIFImageToPCS( gtif, &xCoordMax, &yCoordMax ) )
+			{
+				xCoordMax = 0.0f;
+				yCoordMax = 0.0f; 
+			}	
+
+			if( !GTIFImageToPCS( gtif, &xCoordMin, &yCoordMin ) )
+			{
+				xCoordMax = 0.0f;
+				yCoordMax = 0.0f; 
+			}
+
+			if(yCoordMax < yCoordMin)
+			{
+				double temp = yCoordMax;
+				yCoordMax = yCoordMin;
+				yCoordMin = temp;
+			}
+			
+			if(xCoordMax < xCoordMin)
+			{
+				double temp = xCoordMax;
+				xCoordMax = xCoordMin;
+				xCoordMin = temp;
+			}
+				
+			//Calculate X & Y Spatial Resolution
+			if(RasterModel == RasterPixelIsArea)
+			{
+				xGeoResolution = (xCoordMax - xCoordMin) / (cols);
+				yGeoResolution = (yCoordMax - yCoordMin) / (rows);
+				zGeoResolution = 0.0f;
+			}
+			else if (RasterModel == RasterPixelIsPoint)
+			{
+				xGeoResolution = (xCoordMax - xCoordMin) / (cols-1);
+				yGeoResolution = (yCoordMax - yCoordMin) / (rows-1);
+				zGeoResolution = 0.0f;
+			}
+#ifdef DEBUG
+			printf("xGeoResolution: %lf\n", xGeoResolution);
+			printf("yGeoResolution: %lf\n", yGeoResolution);
+			printf("zGeoResolution: %lf\n", zGeoResolution);
+#endif
+
+			/* 
+			 * Check if current SRID exist. If it is a user-defined project/geographic
+			 * coordinate system, please insert into spatial_ref_sys.
+			 */
+			{
+				char query[QUERY_BUF_LENGTH];
+				uint32 nCount = 0;
+				sprintf(query,"SELECT count(*)::INTEGER FROM \"%s\".\"spatial_ref_sys\" WHERE srid=%d",schema,SRID);
+				res = PQexecParams(
+									conn, 
+									query, 
+									0,
+									NULL,    
+									NULL,
+									NULL,    
+									NULL,
+									1);
+				if (PQresultStatus(res) != PGRES_TUPLES_OK)
+  				{
+					if(outmode != MODE_QUIET)
+						fprintf(stderr, "**Error** when check whether SRID exist: %s. (Does table spatial_ref_sys existed?)", PQerrorMessage(conn));
+			        PQclear(res);
+        			exit_nicely(conn,1);
+  				}	
+				else
+				{
+					nCount = ((uint32*)PQgetvalue(res,0,0))[0];
+					nCount = (uint32)(_ntohl(nCount));
+					PQclear(res);
+				}	
+
+				if(nCount <= 0)
+				{
+					//XXX:NEW SRID, Need to Insert into spatial_ref_sys tables
+				}
+				//else, current srid existed. Good.
+			}
+			
+		}
+		else // NONE SRID 
+		{
+			SRID = -1;
+		}
+	} 
+	//End Reading Geo-Metedata Data
+	
+	//Push Metata Into PGRasterMetadata object. 
+	{
+		WKSEnvelope wksMBR;
+		wksMBR.maxX = xCoordMax;
+		wksMBR.minX = xCoordMin;
+		wksMBR.maxY = yCoordMax;
+		wksMBR.minY = yCoordMin;
+
+		metadata.rasterObjectID = -1;
+		metadata.rasterDimensions = 2;
+		metadata.rasterBandType = BT_MULTI;
+		metadata.rasterDataType = datatype;
+		metadata.rasterValueType = VT_NOMINAL;
+		metadata.rasterSchema = schema; 
+		metadata.rasterDataTable = table; 
+		metadata.rasterBandCount = bands;
+		metadata.rasterRowCount = rows;
+		metadata.rasterColumnCount = cols;
+		metadata.rasterCellDepth = nRealBitsPerPixel;
+		metadata.blockSizeBands = 1;
+		metadata.blockCompression = CT_NONE;
+		metadata.SRID = SRID;
+		metadata.spatialResolutionY = yGeoResolution;
+		metadata.spatialResolutionX = xGeoResolution;
+		metadata.spatialResolutionZ = zGeoResolution;
+		if(SRID != -1)
+			metadata.geoReferenced = TRUE;
+		
+		metadata.spatialExtent = G_MBRToGeometry(&wksMBR);
+
+		if(big_endian)
+			metadata.spatialExtent->obj.byteOrder = wkbXDR;
+		else
+			metadata.spatialExtent->obj.byteOrder = wkbNDR;
+	}
+
+	if(outmode == MODE_VERBOSE)
+	{
+ 		fprintf(stdout, "Finish reading GeoTIFF & TIFF metadata.\n");
+	}
+
+}
+
+void _PreInsertMetadata()	
+{
+	char query[QUERY_BUF_LENGTH];
+	int fldLen = 0;	
+	char *pszValue = NULL;
+
+	if(outmode == MODE_VERBOSE)
+	{
+ 		fprintf(stdout, "Updating PGRaster_Metadata ......\n");
+	}
+
+	/*
+ 	* Before data inserting: Begin a transaction
+ 	* (a cursor can only be defined inside a transaction block)
+ 	*/
 	res=PQexec(conn, "BEGIN");
 	if ( ! res || PQresultStatus(res) != PGRES_COMMAND_OK ) {
 		printf( "%s", PQerrorMessage(conn));
@@ -695,53 +1306,1133 @@
 	}
 	PQclear(res);
 
+	beginTransaction = TRUE;
+
 	/* Insert a new record in the PGRASTER_METADATA table
-	 * If error, such as there is no PGRASTER_METADATA table exist,
-	 * this programe will exit abnormally.
-	 */
-	metaInsert = "";
+ 	* If error, such as there is no PGRASTER_METADATA table exist,
+ 	* this programe will exit abnormally.
+ 	* Using SQL functions.
+ 	*/
+	memset(query, QUERY_BUF_LENGTH, '\0');
+	sprintf(query,"SELECT AddRasterTableFull('%s','%s',%f,%f,%d,%d,%d,%d,%d,%d,%d,%d,%d);",
+					schema,
+					table,
+					metadata.spatialResolutionX,
+					metadata.spatialResolutionY,
+					metadata.rasterBandCount,
+					metadata.rasterRowCount,
+					metadata.rasterColumnCount,
+				  	metadata.rasterDataType,
+					metadata.rasterBandType,
+					metadata.rasterValueType,
+					metadata.blockBandInterleaving,
+					metadata.blockCompression,
+					metadata.SRID);
+	res = PQexecParams(conn,
+                       query,
+                       0,       
+                       NULL,    
+                       NULL,
+                       NULL,    
+                       NULL,    
+                       0);      
+	if ( ! res || PQresultStatus(res) != PGRES_TUPLES_OK )
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "**Error** when execute AddRasterTableFull at server side: %s\n.", PQerrorMessage(conn));
+		exit_nicely(conn, 1);
+	}
+	fldLen = PQgetlength(res,0,0);
+	pszValue = PQgetvalue(res,0,0);
+	metadata.name = malloc(fldLen * sizeof(char)+1);
+	memset(metadata.name,sizeof(char)*fldLen+1,'\0');
+	memcpy(metadata.name,(char*)pszValue,fldLen*sizeof(char));
+	PQclear(res);
+
+	memset(query, QUERY_BUF_LENGTH, '\0');
+	sprintf(query,"SELECT rasterObjectID FROM pgraster_metadata WHERE name='%s'",
+					metadata.name);
+
+#ifdef DEBUG
+	printf("Name=%s\n",metadata.name);
+#endif
+	res = PQexecParams(conn,
+                       query,
+                       0,       
+                       NULL,    
+                       NULL,
+                       NULL,    
+                       NULL,    
+                       0);      
+
+	if ( ! res || PQresultStatus(res) != PGRES_TUPLES_OK )
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "**Error** when trying to retrieval objectid from server side: %s\n.",PQerrorMessage(conn));
+		exit_nicely(conn, 1);
+	}
+
+	if(strcmp(PQgetvalue(res,0,0),"fail")==0)
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "Current schema & table name exist. Please try again using a different pair. PQerrorMessage: %s\n", PQerrorMessage(conn));
+		exit_nicely(conn, 1);
+	}
+	else
+		metadata.rasterObjectID = atoi((char*)PQgetvalue(res,0,0));
+	PQclear(res);
+
+	{
+		const char *paramValues[1];
+   	 	int         paramLengths[1];
+    	int         paramFormats[1];
 		
+		paramValues[0] = (char*)(metadata.spatialExtent);
+		paramLengths[0] = G_GetSize(metadata.spatialExtent);
+		paramFormats[0] = 1; //Binary
+		memset(query, QUERY_BUF_LENGTH, '\0');
+		
+		sprintf(query,"UPDATE \"%s\".\"pgraster_metadata\" SET spatialextent=GeomFromWKB($1,%d) WHERE rasterObjectID=%Ld", 
+				schema,
+				metadata.SRID,
+				metadata.rasterObjectID);
+#ifdef DEBUG
+		printf("Update Spatial Extent Query: %s\n",query);
+#endif
 
+		res = PQexecParams(conn,
+                       query,
+                       1,       
+                       NULL,    
+                       paramValues,
+                       paramLengths, 
+                       paramFormats, 
+                       0);
+
+		if ( PQresultStatus(res) != PGRES_COMMAND_OK )
+		{
+			if(outmode != MODE_QUIET)
+				fprintf(stderr, "**Error** when trying to update spatial extent at server side: %s\n.",PQerrorMessage(conn));
+			exit_nicely(conn, 1);
+		}
+		PQclear(res);
+	}
+
+	{
+		// Create Prepared Insert Statement for Raster Data Insertion
+		insertStmt = (char*)malloc(strlen(schema) + strlen(table) + 1);
+		memset(insertStmt, strlen(schema) + strlen(table) + 1, '\0');
+		memcpy(insertStmt, schema, strlen(schema));
+		memcpy(insertStmt+strlen(schema), table, strlen(table));
+
+		
+		memset(query, QUERY_BUF_LENGTH, '\0');
+		sprintf(query,"INSERT INTO \"%s\".\"%s\"(rasterobjectid,pyramidlevel,bandblocknumber,rowblocknumber,columnblocknumber,blockbandsize,blockrowsize,blockcolumnsize,blockmbr,datablock) Values($1,$2,$3,$4,$5,$6,$7,$8,GeomFromWKB($9),$10)", 
+				schema,
+				table);
+
+		res = PQprepare( 	conn,
+                    		insertStmt,
+                    		query,
+                    		10,
+                    		NULL);
+		if ( PQresultStatus(res) != PGRES_COMMAND_OK )
+		{
+			if(outmode != MODE_QUIET)
+				fprintf(stderr, "**Error** when trying to create prepared statement for data insertion at server side: %s\n.",PQerrorMessage(conn));
+			exit_nicely(conn, 1);
+		}
+		PQclear(res);
+	}
+
+	if(outmode == MODE_VERBOSE)
+	{
+ 		fprintf(stdout, "Finish writing PGRaster_Metadata first time.\n");
+	}
 }
 
+/*
+ * Functions used to clean up temp tables by demo functions. 
+ *
+ * Will only be invoked while testing/debuging mode.
+ */
+void _CleanUpDemo()
+{
+	char query[QUERY_BUF_LENGTH];
+	memset(query, QUERY_BUF_LENGTH, '\0');
+	
+	printf("Executing CleanUpDemo()!!!!\n");
+
+	sprintf(query,"SELECT DropRasterTableByName('%s','%s')", schema,table);
+	printf("Query=%s\n",query);
+	res = PQexecParams(conn,
+    	               query,
+                       0,       
+                       NULL,    
+                       NULL,
+                       NULL, 
+                       NULL, 
+                       0); 
+
+	if ( ! res || PQresultStatus(res) != PGRES_TUPLES_OK )
+	{
+		printf("Error when trying to clean up testing tables at server side: %s\n.",PQerrorMessage(conn));
+	}
+	
+	PQclear(res);
+}
+
 /* Step 2. LoadData */
 void LoadData()
 {
+	uint32 blockRowSize = metadata.blockSizeRows;
+	uint32 blockColumnSize = metadata.blockSizeColumns;
+	uint32 blockBandSize = metadata.blockSizeBands;
+	byte *data = NULL;
+	uint32 datalength = 0;
+	uint32 objectid = metadata.rasterObjectID;
+	WKBGeometry* blockMBR = NULL;
+	WKSEnvelope wksMBR;
+	const char *paramValues[10];
+	int         paramLengths[10];
+	int         paramFormats[10];
+	dblNoDataValue = metadata.nodataValue;
+	int i;
 
+	if(outmode == MODE_VERBOSE)
+	{
+ 		fprintf(stdout, "Start loading GeoTIFF data into PostgreSQL/PostGIS.\n");
+	}
+
+	nPyramidDepth = 0;
+
+	//Calculate Pyramid Depth
+	nPyramidDepth = CalculatePyramidDepth(rows,cols,blockRowSize,blockColumnSize);
+
+	//Begin TIFF Reader
+	if(!_BeginReadTIFF())
+	{
+		fprintf(stderr, "Error when initialize tiff reader.\n");
+		exit_nicely(conn,1);
+	}
+
+	//Read Data in Scanline Line Modes & Insert into RasterData Table.
+	//By Default
+	for(i = 0 ; i < bands ; i++)
+	{
+		uint32 nPyramidLevel = 1;
+		while(1)
+		{
+			uint32 nBlockIndex_H = 1 ;
+			uint32 nBlockIndex_V = 1 ;
+			uint32 nBlockIndex_B = i + 1;
+			long nColumns_P = 0;
+			long nRows_P = 0;
+			long nBlockHorizontal_P;
+			long nBlockVertical_P;
+
+			if(nPyramidLevel > nPyramidDepth)
+				break;
+
+			if(cols%(long)pow(2,nPyramidLevel-1) == 0)
+			{
+				nColumns_P = (long)(cols /(long)pow(2,nPyramidLevel-1));
+			}
+			else
+			{
+				nColumns_P = (long)(cols /(long)pow(2,nPyramidLevel-1) + 1);
+			}
+
+			if(rows % (long)pow(2,nPyramidLevel-1) == 0)
+			{
+				nRows_P = (long)(rows/(long)pow(2,nPyramidLevel-1));
+			}
+			else
+			{
+				nRows_P = (long)(rows/(long)pow(2,nPyramidLevel -1)+1);
+			}
+
+			nBlockHorizontal_P = (int)((nColumns_P%blockColumnSize) == 0? (nColumns_P/blockColumnSize):(nColumns_P/blockColumnSize + 1));
+			nBlockVertical_P = (int)((nRows_P%blockRowSize) == 0? (nRows_P/blockRowSize):(nRows_P/blockRowSize + 1));
+
+
+			while(1)
+			{
+				uint32 nBufferWidth = 0;
+				uint32 nBufferHeight = 0;
+				int row,col;
+				int nCurByte = 0;
+				int nCurBit = 0; // Use when bps < 8
+				long nMaxCol = 0;
+				long nMinCol = 0;
+				long nMaxRow = 0;
+				long nMinRow = 0;
+
+				if(nBlockIndex_H > nBlockHorizontal_P || nBlockIndex_V > nBlockVertical_P)
+					break;
+				
+				if(nBlockIndex_H == nBlockHorizontal_P)
+					nBufferWidth = (int)(nColumns_P - blockColumnSize*(nBlockIndex_H -1));
+				else
+					nBufferWidth = blockColumnSize;
+
+				if(nBlockIndex_V == nBlockVertical_P)
+					nBufferHeight = (int)(nRows_P- blockRowSize*(nBlockIndex_V -1));
+				else
+					nBufferHeight = blockRowSize;
+				
+				datalength = nBufferWidth * nBufferHeight * nRealBitsPerPixel;
+				if(datalength % 8 != 0)
+					datalength = (datalength / 8) +1;
+				else
+					datalength = datalength / 8;
+
+				data = malloc(sizeof(char)* datalength);
+				
+				for( row = 0 ; row < nBufferHeight;row++)
+				{
+					for(col = 0 ; col < nBufferWidth;col++)
+					{									
+						long nCol_Local = ((long)pow(2,nPyramidLevel-1))*((nBlockIndex_H-1)*blockColumnSize+col);
+						long nRow_Local = ((long)pow(2,nPyramidLevel-1))*((nBlockIndex_V-1)*blockRowSize+row);
+						
+						int nLen = -1;
+
+						//Read Data Here 
+						byte* pData = _GetTIFFAt(nCol_Local, nRow_Local,i, &nLen);
+
+						//Store data to Byte buffer (should we consider the BSQ/BIL/BIP??)
+						if(nLen < 8)
+						{
+							if(nLen == 1)
+							{
+								//black white
+								data[nCurByte] = SetSingleBitAt(data[nCurByte],pData[0],nCurBit);
+								nCurBit += 1;
+								if(nCurBit == 8)
+								{
+									nCurByte += 1;
+									nCurBit = 0;
+								}
+							}
+							else if(nLen == 2)
+							{
+								//2 bits Grey Level
+								data[nCurByte] = SetMultiBitAt(data[nCurByte],pData[0],2,nCurBit);
+								nCurBit += 2;
+								if(nCurBit == 8)
+								{
+									nCurByte += 1;
+									nCurBit = 0;
+								}
+							}
+							else if(nLen == 4)
+							{
+								//4 bits Grey Level
+								data[nCurByte] = SetMultiBitAt(data[nCurByte],pData[0],4,nCurBit);
+								nCurBit += 4;
+								if(nCurBit == 8)
+								{
+									nCurByte += 1;
+									nCurBit = 0;
+								}
+							}
+						}
+						else
+						{
+							memcpy(data+nCurByte,pData,nLen/8);
+							nCurByte += (nLen / 8);
+						}
+						
+						free(pData);	
+					}
+				}
+
+				// Calculate Max/Min Column & Row & Make block MBR
+				nMaxCol = ((long)pow(2,nPyramidLevel-1))*((nBlockIndex_H-1)*blockColumnSize+nBufferWidth) - 1;
+				if(nMaxCol >= cols)
+					nMaxCol = cols - 1;
+				nMinCol = ((long)pow(2,nPyramidLevel-1))*((nBlockIndex_H-1)*blockColumnSize);
+				nMaxRow = ((long)pow(2,nPyramidLevel-1))*((nBlockIndex_V-1)*blockRowSize+nBufferHeight) - 1;
+				if(nMaxRow >= rows)
+					nMaxRow = rows - 1;
+				nMinRow = ((long)pow(2,nPyramidLevel-1))*((nBlockIndex_V-1)*blockRowSize);
+
+				if(outmode == MODE_VERBOSE)
+					fprintf(stdout, "Pyramid:%d, Block:(%d,%d,%d), MBR(%ld %ld,%ld %ld)\n", (int)nPyramidLevel, (int)nBlockIndex_H, (int)nBlockIndex_V, (int)nBlockIndex_B, nMinCol, nMinRow, nMaxCol, nMaxRow);
+
+				wksMBR.maxX = nMaxCol;
+				wksMBR.minX = nMinCol;
+				wksMBR.maxY = nMaxRow;
+				wksMBR.minY = nMinRow;
+				blockMBR = G_MBRToGeometry(&wksMBR);
+
+				// Insert Data Record in Raster Data Table
+				// 1. rasterobjectid
+				{
+					//Number in network byte order
+					uint32 n_objectid64,
+						   n_pyramidlevel,
+						   n_bandblocknumber,
+						   n_rowblocknumber,
+						   n_columnblocknumber,
+						   n_blockbandsize,
+						   n_blockrowsize,
+						   n_blockcolumnsize;
+
+					//n_objectid = _htonl(objectid);
+					n_objectid64 = _htonl((_uint64)objectid);
+					paramValues[0] = (char*)(&(n_objectid64));
+					paramLengths[0] = sizeof(n_objectid64);
+					paramFormats[0] = 1; // Binary / Endian??
+
+					// 2. pyramidlevel
+					n_pyramidlevel = _htonl(nPyramidLevel);
+					paramValues[1] = (char*)(&(n_pyramidlevel));
+					paramLengths[1] = sizeof(n_pyramidlevel);
+					paramFormats[1] = 1; // Binary / Endian??
+
+					// 3. bandblocknumber
+					n_bandblocknumber = _htonl(nBlockIndex_B);
+					paramValues[2] = (char*)(&(n_bandblocknumber));
+					paramLengths[2] = sizeof(n_bandblocknumber);
+					paramFormats[2] = 1; // Binary / Endian??
+
+					// 4. rowblocknumber
+					n_rowblocknumber = _htonl(nBlockIndex_V);
+					paramValues[3] = (char*)(&(n_rowblocknumber));
+					paramLengths[3] = sizeof(n_rowblocknumber);
+					paramFormats[3] = 1; // Binary / Endian??
+
+					// 5. columnblocknumber
+					n_columnblocknumber = _htonl(nBlockIndex_H);
+					paramValues[4] = (char*)(&(n_columnblocknumber));
+					paramLengths[4] = sizeof(n_columnblocknumber);
+					paramFormats[4] = 1; // Binary / Endian??
+
+					// 6. blockbandsize
+					n_blockbandsize = _htonl(blockBandSize);
+					paramValues[5] = (char*)(&(n_blockbandsize));
+					paramLengths[5] = sizeof(n_blockbandsize);
+					paramFormats[5] = 1; // Binary / Endian??
+
+					// 7. blockrowsize
+					n_blockrowsize = _htonl(nBufferHeight);
+					paramValues[6] = (char*)(&(n_blockrowsize));
+					paramLengths[6] = sizeof(n_blockrowsize);
+					paramFormats[6] = 1; // Binary / Endian??
+
+					// 8. blockcolumnsize
+					n_blockcolumnsize = _htonl(nBufferWidth);
+					paramValues[7] = (char*)(&(n_blockcolumnsize));
+					paramLengths[7] = sizeof(n_blockcolumnsize);
+					paramFormats[7] = 1; // Binary / Endian??
+
+					// 9. blockmbr
+					paramValues[8] = (byte*)blockMBR;
+					paramLengths[8] = G_GetSize(blockMBR);
+					paramFormats[8] = 1; // Binary??
+
+					//Should we compressed the data here before insertion.
+
+					// 10. datablock
+					paramValues[9] = (char*)data;
+					paramLengths[9] = datalength;
+					paramFormats[9] = 1; // Binary??
+
+					// Execute Prepared Statement
+					res = PQexecPrepared( 	conn,
+                       						insertStmt,
+                       						10,           
+                       						paramValues,
+                       						paramLengths, 
+                       						paramFormats, 
+                       						0
+										);
+
+					if ( PQresultStatus(res) != PGRES_COMMAND_OK )
+					{
+						if(outmode != MODE_QUIET)
+							fprintf(stderr, "**Error** when trying to insert raster data at server side: %s\n.",PQerrorMessage(conn));
+						exit_nicely(conn, 1);
+					}
+					PQclear(res);
+				}
+				
+
+				// Free Memory
+				free(data);
+				G_DestroyGeometry(blockMBR);
+				blockMBR = NULL;
+
+				// Update Old Trailers
+				if(nBlockIndex_H == nBlockHorizontal_P && nBlockIndex_V < nBlockVertical_P)
+				{
+					nBlockIndex_H = 1;
+					nBlockIndex_V ++ ;
+				}
+				else
+				{
+					nBlockIndex_H ++;
+				}		
+				
+			}
+
+			// Update nPyramidLevel
+			nPyramidLevel++ ;
+		}
+	}
+
+	if(outmode == MODE_VERBOSE)
+	{
+ 		fprintf(stdout, "Finish GeoTIFF data loading.\n");
+	}
 }
 
-/* Step 3. CreateIndex() */
+int _BeginReadTIFF()
+{
+	
+	int result = 0;
+	
+	if((mode==PHOTOMETRIC_RGB) && (spp==4))
+		hasAlpha = 1;
+	else
+		hasAlpha = 0;
+
+	// Read in the possibly multiple strips
+  	stripSize = TIFFStripSize (tif);
+  	stripMax = TIFFNumberOfStrips (tif);
+  	imageOffset = 0;
+
+	bufferSize = stripMax * stripSize;
+
+	if((pDataBuffer = (char *) malloc(bufferSize)) == NULL)
+	{
+    	if(outmode != MODE_QUIET)
+			fprintf(stderr, "Could not allocate enough memory for the uncompressed TIFF image.\n");
+     	return 0;
+  	}
+
+	if( mode == PHOTOMETRIC_CIELAB )
+		_initCIELabConversion(tif);
+
+	for (stripCount = 0; stripCount < stripMax; stripCount++)
+	{
+    	if((result = TIFFReadEncodedStrip (tif, stripCount,
+				      pDataBuffer + imageOffset,
+				      stripSize)) == -1)
+		{
+      		if(outmode != MODE_QUIET)
+				fprintf(stderr, "**Error** read TIFF data in strip of number %d\n", (unsigned int)stripCount);
+      		return 0;
+    	}
+
+    	imageOffset += result;
+  	}
+
+	return 1;
+	
+}
+
+static TIFFDisplay display_sRGB = {
+	{	
+		/* XYZ -> luminance matrix */
+		{  3.2410F, -1.5374F, -0.4986F },
+		{  -0.9692F, 1.8760F, 0.0416F },
+		{  0.0556F, -0.2040F, 1.0570F }
+	},	
+	100.0F, 100.0F, 100.0F,	/* Light o/p for reference white */
+	255, 255, 255,		    /* Pixel values for ref. white */
+	1.0F, 1.0F, 1.0F,	    /* Residual light o/p for black pixel */
+	2.4F, 2.4F, 2.4F,	    /* Gamma values for the three guns */
+};
+
+void _initCIELabConversion(TIFF* pTif)
+{
+	float   *whitePoint;
+
+	if( !cielab)
+    {
+		cielab = (TIFFCIELabToRGB *)_TIFFmalloc(sizeof(TIFFCIELabToRGB));
+    }
+
+	TIFFGetFieldDefaulted(pTif, TIFFTAG_WHITEPOINT, &whitePoint);
+	refWhite[1] = 100.0F;
+	refWhite[0] = whitePoint[0] / whitePoint[1] * refWhite[1];
+	refWhite[2] = (1.0F - whitePoint[0] - whitePoint[1])
+		      / whitePoint[1] * refWhite[1];
+	if (TIFFCIELabToRGBInit(cielab, &display_sRGB, refWhite) < 0)
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "Failed to initialize CIE L*a*b*->RGB conversion state.");
+	}
+}
+
+byte* _GetTIFFAt(int row, int col, int band, int *bitsreturned)
+{
+
+	*bitsreturned = 0;
+	byte* buffer = NULL;
+	// By Default, we assume that TIFF uses a BSQ packing schema. (Only work for bps=n*8)
+	int nIndex = (cols * row + col ) * nTIFFBytePerPixel * spp;
+
+
+	// if there is no data buffer available or we need to move on the cursor
+	if( (spp==3) || (spp==4) ) // Multi-Channel
+	{
+		if(bps == 8 && mode==PHOTOMETRIC_RGB)
+		{
+			*bitsreturned = spp * 8;
+			buffer = (char*)malloc(spp*sizeof(char));
+			memcpy(buffer, (byte*)(&(pDataBuffer[nIndex])), spp);
+		}
+		else if (bps==16 && mode==PHOTOMETRIC_RGB) 
+		{
+			*bitsreturned = spp*16;
+			buffer = (byte*)malloc(spp*sizeof(uint16));
+			if(spp == 3 ) // RGB
+			{
+				((uint16*)buffer)[0] = ((uint16*)(&(pDataBuffer[nIndex])))[0]; // Red
+				((uint16*)buffer)[1] = ((uint16*)(&(pDataBuffer[nIndex])))[1]; // Green
+				((uint16*)buffer)[2] = ((uint16*)(&(pDataBuffer[nIndex])))[2]; // Blue
+				if( ! tiff_bigendian)
+				{
+					// inverse byte order
+					((uint16*)buffer)[0] = _ntohs(((uint16*)buffer)[0]);
+					((uint16*)buffer)[1] = _ntohs(((uint16*)buffer)[1]);
+					((uint16*)buffer)[2] = _ntohs(((uint16*)buffer)[2]);
+				}
+			}
+			else if(spp == 4) // RGBA
+			{
+				((uint16*)buffer)[0] = ((uint16*)(&(pDataBuffer[nIndex])))[0]; // Red
+				((uint16*)buffer)[1] = ((uint16*)(&(pDataBuffer[nIndex])))[1]; // Green
+				((uint16*)buffer)[2] = ((uint16*)(&(pDataBuffer[nIndex])))[2]; // Blue
+				((uint16*)buffer)[3] = ((uint16*)(&(pDataBuffer[nIndex])))[3]; // Alpha
+				if( ! tiff_bigendian)
+				{
+					// inverse byte order
+					((uint16*)buffer)[0] = _ntohs(((uint16*)buffer)[0]);
+					((uint16*)buffer)[1] = _ntohs(((uint16*)buffer)[1]);
+					((uint16*)buffer)[2] = _ntohs(((uint16*)buffer)[2]);
+					((uint16*)buffer)[3] = _ntohs(((uint16*)buffer)[3]);
+				}
+			}
+		}
+		else
+		{
+			if( format != SAMPLEFORMAT_UINT && format != SAMPLEFORMAT_INT && format != SAMPLEFORMAT_IEEEFP )
+			{
+				if(outmode != MODE_QUIET)
+					fprintf(stderr, "**Error**: Unsupported TIFF sample format.\n");
+				exit_nicely(conn,1);
+			}
+	        if( format == SAMPLEFORMAT_IEEEFP && bps != 32 )
+			{
+				if(outmode != MODE_QUIET)
+					fprintf(stderr, "**Error**: Unsupported TIFF sample format.\n");
+				exit_nicely(conn,1);
+			}
+			if( planar != PLANARCONFIG_CONTIG )
+			{
+				if(outmode != MODE_QUIET)
+					fprintf(stderr, "**Error**: Unsupported PLANARCONFIG_CONTIG sample format.\n");
+				exit_nicely(conn,1);
+			}
+
+			switch(mode)
+			{
+				case PHOTOMETRIC_RGB:
+				{
+					// Return RGBA data. 
+					// Can't happen here. It should happened at previous IF...THEN section.
+					if(outmode != MODE_QUIET)
+						fprintf(stdout, "**Error**: Can't have such TIFF sample format.\n");
+					break;
+				}
+				case PHOTOMETRIC_CIELAB:
+				{
+					// Coverted into RGBA mode and return
+					char* p = (char*) (&(pDataBuffer[nIndex])); // a and b are signed, L is not...
+                    float  X=0, Y=0, Z=0; 
+					uint32 r=0, g=0, b=0; 
+					TIFFCIELabToXYZ(cielab,
+                                   ((unsigned char* )p)[0], // *NO* sign extension for L !
+                                   p[1], p[2], 
+                                   &X, &Y, &Z);
+                    TIFFXYZToRGB(cielab, X, Y, Z, &r, &g, &b);
+				
+					if(bps == 8)
+					{
+						*bitsreturned = 3 * 8;
+						buffer = (byte*)malloc(3*sizeof(char));
+						buffer[0] = r;
+						buffer[1] = g;
+						buffer[2] = b;
+					}
+					else if(bps == 16)
+					{
+						*bitsreturned = 3 * 16;
+						buffer = (byte*)malloc(6);
+						((uint16*)buffer)[0] = (uint16)r; // Red
+						((uint16*)buffer)[1] = (uint16)g; // Green
+						((uint16*)buffer)[2] = (uint16)b; // Blue
+					}
+					else
+					{
+						if(outmode != MODE_QUIET)
+							fprintf(stderr, "**Error**: Unsupported sample format sample format.\n");
+						exit_nicely(conn,1);
+					}
+
+					break;
+				}
+				default:
+				{
+					*bitsreturned = bps;
+
+					if(band >= spp)
+					{	
+						if(outmode != MODE_QUIET)
+							fprintf(stderr, "**Error**: Unsupported PLANARCONFIG_CONTIG sample format.\n");
+						exit_nicely(conn,1);
+					}
+					
+					// Directly return data
+					if(bps < 8)
+					{
+						//less than 1 bytes
+						int nIndexInByte = (nTIFFBitsPerPixel* (cols * row + col )) / 8;
+						int nOffsetInBits = (nTIFFBitsPerPixel* (cols * row + col )) % 8;
+						buffer = (byte*)malloc(sizeof(char));
+						byte value = ((byte*)pDataBuffer)[nIndexInByte];
+						if(bps == 1)
+						{												
+							buffer[0] = GetSingleBitAt(value, nOffsetInBits);
+						}
+						else if(bps == 2 || bps == 4)
+						{						
+							byte value = ((byte*)pDataBuffer)[nIndexInByte];
+							buffer[0] = GetMultiBitAt(value, nOffsetInBits,bps);
+						}
+						else 
+						{
+							if(outmode != MODE_QUIET)
+								fprintf(stderr, "**Error**: Unsupported PLANARCONFIG_CONTIG sample format.\n");
+							exit_nicely(conn,1);
+						}
+					}
+					else
+					{
+						if(bps == 8)
+						{
+							buffer = (byte*)malloc(sizeof(byte));
+							buffer[0] = ((byte*)pDataBuffer)[nIndex+band]; // TIFF By Default BSQ.
+						}
+						else if(bps == 16)
+						{
+							buffer = (byte*)malloc(sizeof(_uint16));
+							*((_uint16*)buffer) = ((_uint16*)pDataBuffer)[nIndex+band]; // TIFF By Default BSQ.
+							if(!tiff_bigendian)
+							{
+								*((_uint16*)buffer) = _ntohs(*((_uint16*)buffer));
+							}
+						}
+						else if(bps == 32)
+						{
+							buffer = (byte*)malloc(sizeof(_uint32));
+							*((_uint32*)buffer) = ((_uint32*)pDataBuffer)[nIndex+band]; // TIFF By Default BSQ.
+							if(!tiff_bigendian)
+							{
+								*((_uint32*)buffer) = _ntohl(*((_uint32*)buffer));
+							}
+						}
+						else if(bps == 64)
+						{
+							buffer = (byte*)malloc(sizeof(_int64));
+							*((_int64*)buffer) = ((_int64*)pDataBuffer)[nIndex+band]; // TIFF By Default BSQ.
+							if(!tiff_bigendian)
+							{
+								*((_int64*)buffer) = _ntohll(*((_int64*)buffer));
+							}
+						}
+						else 
+						{
+							if(outmode != MODE_QUIET)
+								fprintf(stderr, "**Error**: Unsupported PLANARCONFIG_CONTIG sample format.\n");
+							exit_nicely(conn,1);
+						}
+					}
+					break;
+				}
+			}
+		}
+	}
+	else if( spp==1 ) // Single Channel
+    {
+		int colors = (bps <8) ? 1<<bps : 256;
+
+		if(band != 0)
+		{	
+			if(outmode != MODE_QUIET)
+				fprintf(stderr, "**Error**: Unsupported PLANARCONFIG_CONTIG sample format.\n");
+			exit_nicely(conn,1);
+		}
+
+		if( mode==PHOTOMETRIC_PALETTE ) // Image with Palette
+      	{
+          	uint16 *red=0, *green=0, *blue=0;
+			_uint64 c = 0;
+			if(bps == 8 && format == SAMPLEFORMAT_INT) //char
+				c = ((char*)pDataBuffer)[nIndex];
+			else if(bps == 8) //byte
+				c = ((byte*)pDataBuffer)[nIndex];
+			else if(bps == 16 && format == SAMPLEFORMAT_INT) // short
+				c = ((int16*)pDataBuffer)[nIndex];
+			else if(bps == 16) // usigned short
+				c = ((uint16*)pDataBuffer)[nIndex];
+			else if(bps == 32 && format == SAMPLEFORMAT_INT) // long
+				c = ((int32*)pDataBuffer)[nIndex];
+			else if(bps == 32) // unsigned long
+				c = ((uint32*)pDataBuffer)[nIndex];
+			else if(bps == 64 && format == SAMPLEFORMAT_INT) // long long
+				c = ((_int64*)pDataBuffer)[nIndex];
+			else if(bps == 64) // unsigned long long
+				c = ((_uint64*)pDataBuffer)[nIndex];
+			else 
+			{
+				if(outmode != MODE_QUIET)
+					fprintf(stderr, "**Error**: Unsupported sample format\n");
+				exit_nicely(conn,1);
+			}
+			
+
+          	if( ! TIFFGetField(tif, TIFFTAG_COLORMAP, &red, &green, &blue)  && outmode != MODE_QUIET)
+				fprintf(stderr,"**Warning** Missing palette data in color-palette TIFF image\n");
+			else
+          	{              
+            	if( badIndians )
+              	{
+                  	TIFFSwabArrayOfShort(red,   colors);
+                  	TIFFSwabArrayOfShort(green, colors);
+                  	TIFFSwabArrayOfShort(blue,  colors);
+              	}
+              	
+              	*bitsreturned = 3*8;
+				buffer = (byte*)malloc(3*sizeof(char));
+				buffer[0] = red[c]>>8;
+				buffer[1] = green[c]>>8;
+				buffer[2] = blue[c]>>8;
+          	}
+		}
+		else if( bps == 1 && ((mode==PHOTOMETRIC_MINISWHITE) || (mode==PHOTOMETRIC_MINISBLACK)) ) 
+		// Black White Pictures
+		{
+			int nIndexInByte = (nTIFFBitsPerPixel* (cols * row + col )) / 8;
+			int nOffsetInBits = (nTIFFBitsPerPixel* (cols * row + col )) % 8;						
+			buffer = (byte*)malloc(sizeof(char));
+			byte c = ((byte*)pDataBuffer)[nIndexInByte];
+			
+			if(mode == PHOTOMETRIC_MINISWHITE)
+				c = ~c;
+
+			if(fillorder != FILLORDER_MSB2LSB)
+			{
+    			// We need to SWAP bits -- ABCDEFGH becomes HGFEDCBA
+      		    byte tempbyte = 0;
+      			if(c & 128) tempbyte += 1;
+      			if(c & 64) tempbyte += 2;
+      			if(c & 32) tempbyte += 4;
+      			if(c & 16) tempbyte += 8;
+      			if(c & 8) tempbyte += 16;
+      			if(c & 4) tempbyte += 32;
+      			if(c & 2) tempbyte += 64;
+      			if(c & 1) tempbyte += 128;
+      			c = tempbyte;
+    		}
+
+			// Pick Up the right bits and return it as bitslength = 1
+			buffer[0] = GetSingleBitAt(c,nOffsetInBits);			
+			*bitsreturned = 1;
+		}
+		else  
+		// Ordinary Grey Scale Images or special value image (DEM) 
+		{
+			// Should I consider the Indians??
+			// All the data will be stored in BigEndian format.
+			// Directly return data
+			int nIndexInByte = (nTIFFBitsPerPixel* (cols * row + col )) / 8;
+			int nOffsetInBits = (nTIFFBitsPerPixel* (cols * row + col )) % 8;
+			if(bps < 8)
+			{
+				byte c = ((byte*)pDataBuffer)[nIndexInByte];
+				if(fillorder != FILLORDER_MSB2LSB)
+				{
+    				// We need to SWAP bits -- ABCDEFGH becomes HGFEDCBA
+      		    	byte tempbyte = 0;
+      				if(c & 128) tempbyte += 1;
+      				if(c & 64) tempbyte += 2;
+      				if(c & 32) tempbyte += 4;
+      				if(c & 16) tempbyte += 8;
+      				if(c & 8) tempbyte += 16;
+      				if(c & 4) tempbyte += 32;
+      				if(c & 2) tempbyte += 64;
+      				if(c & 1) tempbyte += 128;
+      				c = tempbyte;
+    			}
+
+				//less than 1 bytes
+				buffer = (byte*)malloc(sizeof(char));
+				if(bps == 1)
+				{
+					buffer[0] = GetSingleBitAt(c, nOffsetInBits);
+				}
+				else if(bps == 2 || bps == 4)
+				{
+					buffer[0] = GetMultiBitAt(c, nOffsetInBits,bps);
+				}
+				else 
+				{
+					if(outmode != MODE_QUIET)
+						fprintf(stderr, "**Error**: Unsupported PLANARCONFIG_CONTIG sample format.\n");
+					exit_nicely(conn,1);
+				}
+			}
+			else if(bps == 8 && format == SAMPLEFORMAT_INT) //char
+			{
+				*bitsreturned = 8;
+				buffer = (char*)malloc(1*sizeof(char));
+				buffer[0]= ((char*)pDataBuffer)[nIndex];
+				
+			}
+			else if(bps == 8) //unsigned char / byte
+			{
+				*bitsreturned = 8;
+				buffer = (byte*)malloc(1*sizeof(char));
+				buffer[0]= ((byte*)pDataBuffer)[nIndex];
+			}
+			else if(bps == 16 && format == SAMPLEFORMAT_INT) // short
+			{
+				int16 c;
+				*bitsreturned = 2*8;
+				buffer = (char*)malloc(2*sizeof(char));
+				c= ((int16*)pDataBuffer)[nIndex];
+				memcpy(buffer,(byte*)&c,2);
+				if(!tiff_bigendian)
+					*((int16*)buffer) = _ntohs(*((int16*)buffer));
+			}
+			else if(bps == 16) // unsigned short
+			{
+				uint16 c;
+				*bitsreturned = 2*8;
+				buffer = (char*)malloc(2*sizeof(char));
+				c= ((uint16*)pDataBuffer)[nIndex];
+				memcpy(buffer,(byte*)&c,2);
+				if(!tiff_bigendian)
+					*((uint16*)buffer) = _ntohs(*((uint16*)buffer));
+			}
+			else if(bps == 32 && format == SAMPLEFORMAT_INT) // long
+			{
+				int32 c;
+				*bitsreturned = 4*8;
+				buffer = (char*)malloc(4*sizeof(char));
+				c= ((int32*)pDataBuffer)[nIndex];
+				memcpy(buffer,(byte*)&c,4);
+				if(!tiff_bigendian)
+					*((int32*)buffer) = _ntohl(*((int32*)buffer));
+			}
+			else if(bps == 32 && format == SAMPLEFORMAT_IEEEFP) // IEEE FP
+			{
+				uint32 c;
+				*bitsreturned = 4*8;
+				buffer = (char*)malloc(4*sizeof(char));
+				c= ((uint32*)pDataBuffer)[nIndex];
+				memcpy(buffer,(byte*)&c,4);
+				//XXX: I don't know how to swap bytes order of IEEE FP.
+				if(!tiff_bigendian)
+					*((int32*)buffer) = _ntohl(*((int32*)buffer));
+			}
+			else if(bps == 32) // unsigned long
+			{
+				uint32 c;
+				*bitsreturned = 4*8;
+				buffer = (char*)malloc(4*sizeof(char));
+				c= ((uint32*)pDataBuffer)[nIndex];
+				memcpy(buffer,(byte*)&c,4);
+				if(!tiff_bigendian)
+					*((uint32*)buffer) = _ntohl(*((uint32*)buffer));
+			}
+			else 
+			{
+				if(outmode != MODE_QUIET)
+					fprintf(stderr, "Invalid PHOTOMETRIC Mode or Sample Format in single channel TIFF image (mode=%d)", mode);
+				exit_nicely(conn,1);
+			}
+		}
+				
+	}
+
+	return buffer;
+}
+
+void _EndReadTIFF()
+{
+	// Free memory usage
+	if(pDataBuffer != NULL)
+		free(pDataBuffer);
+	pDataBuffer = NULL;
+}
+
+
+
+/* Step 3. CreateIndex GiST Index on MBR of each block */
 void CreateIndex()
 {
+	char query[QUERY_BUF_LENGTH];
+	memset(query, QUERY_BUF_LENGTH, '\0');
+	if(outmode == MODE_VERBOSE)
+		fprintf(stdout, "Start building GiST on block mbr.\n");
+	sprintf(query,"CREATE INDEX \"index_%s_%s\" ON \"%s\".\"%s\" using GIST ( blockMBR GIST_GEOMETRY_OPS)",
+					schema, table, schema, table);
+	res = PQexecParams(conn,
+                       query,
+                       0,       
+                       NULL,    
+                       NULL,
+                       NULL,    
+                       NULL,    
+                       0);
 
+	if ( ! res || PQresultStatus(res) != PGRES_COMMAND_OK )
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "**Error** when create spatial index on block MBR at server side: %s\n.",PQerrorMessage(conn));
+		exit_nicely(conn, 1);
+	}
+
+	if(outmode == MODE_VERBOSE)
+		fprintf(stdout, "Finish GiST on block mbr.\n");
 }
 
 /* Step 4. LoadSRS */
 void LoadSRS()
 {
+	// Update record in PGRASTER_SRS table
+	double	adfCoeff[6], x, y;
+	char query[QUERY_BUF_LENGTH];
 
+	memset(query,QUERY_BUF_LENGTH,'\0');
+
+	if(outmode == MODE_VERBOSE)
+		fprintf(stdout, "Start loading SRS information.\n");
+	/*
+     * Compute the coefficients.
+     */
+    x = 0.5;
+    y = 0.5;
+    if( !GTIFImageToPCS( gtif, &x, &y ) )
+        return;
+    adfCoeff[4] = x;
+    adfCoeff[5] = y;
+
+    x = 1.5;
+    y = 0.5;
+    if( !GTIFImageToPCS( gtif, &x, &y ) )
+        return;
+    adfCoeff[0] = x - adfCoeff[4];
+    adfCoeff[1] = y - adfCoeff[5];
+
+    x = 0.5;
+    y = 1.5;
+    if( !GTIFImageToPCS( gtif, &x, &y ) )
+        return;
+    adfCoeff[2] = x - adfCoeff[4];
+    adfCoeff[3] = y - adfCoeff[5];
+
+	//Insert into PostgreSQL
+	// adfCoeff[0-5] = [A-F]
+	// A(0), B(1), C(2), D(3), E(4), F(5)
+	// Xgeo = E + Xpixel * A + Ypixel * C
+	// Ygeo = F + Ypixel * D + Xpixel * B
+	sprintf(query, "UPDATE \"%s\".\"pgraster_srs\" SET rowdenominator='{%lf,%lf,%lf}', columndenominator='{%lf,%lf,%lf}' WHERE rasterObjectID=%Ld",schema, adfCoeff[5], adfCoeff[3],adfCoeff[1],adfCoeff[4], adfCoeff[2],adfCoeff[0],metadata.rasterObjectID);
+
+	res = PQexec(conn,query);
+
+	if ( ! res || PQresultStatus(res) != PGRES_COMMAND_OK )
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "**Error** when update SRS information at server side: %s\n.",PQerrorMessage(conn));
+		exit_nicely(conn, 1);
+	}
+
+	PQclear(res);
+	
+	if(outmode == MODE_VERBOSE)
+		fprintf(stdout, "Finish loading SRS information.\n");
+	
 }
 
 /* Step 5. UpdateMetadata */
 void UpdateMetadata()
 {
+	// Some metadata need to be updated after the data loading.
+	char query[QUERY_BUF_LENGTH];
+	memset(query, QUERY_BUF_LENGTH, '\0');
+	if(outmode == MODE_VERBOSE)
+		fprintf(stdout, "Start updating metadata second time.\n");
+	sprintf(query,"UPDATE \"%s\".\"pgraster_metadata\" SET rasterpyramiddepth=%d WHERE rasterObjectID=%Ld", schema, (int)nPyramidDepth, metadata.rasterObjectID);
 
+	res = PQexecParams(conn,
+                       query,
+                       0,       
+                       NULL,    
+                       NULL,
+                       NULL,    
+                       NULL,    
+                       0);
+
+	if ( ! res || PQresultStatus(res) != PGRES_COMMAND_OK )
+	{
+		if(outmode != MODE_QUIET)
+			fprintf(stderr, "**Error** when updating spatial metadata at server side: %s\n.",PQerrorMessage(conn));
+		exit_nicely(conn, 1);
+	}
+
+	if(outmode == MODE_VERBOSE)
+		fprintf(stdout, "Finish updateing metadata second time.\n");
 }
 
 /* Step 6. Cleanup */
 void Cleanup()
 {
 	/* end the transaction */
+	res = PQexec(conn, "COMMIT");
+	PQclear(res);
+
 	res = PQexec(conn, "END");
 	PQclear(res);
 
 	/* Close Connection*/
-	exit_nicely(conn,1);
+	PQfinish(conn);	
+
+	/* Close GeoTIFF File */
+	if (gtif) GTIFFree(gtif);
+    if (tif) XTIFFClose(tif); 
+
 }
 
 /* Step 7. PrintResultMessage */
-void PrintResultMessage()
+void PrintResultMessage(int sucessful)
 {
-	
+	if(sucessful == 1)
+	{
+		//sucessful
+		fprintf(stdout, "GeoTIFF file '%s' importing failed.\n", geotiff_file);
+	}
+	else
+	{
+		//fail
+		fprintf(stdout, "GeoTIFF file '%s' succesfully imported.\n", geotiff_file);
+	}
 }
 

Modified: branches/gSoC2007_raster/pgraster/pgraster.sql
===================================================================
--- branches/gSoC2007_raster/pgraster/pgraster.sql	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/pgraster.sql	2007-08-17 22:46:15 UTC (rev 2696)
@@ -49,6 +49,7 @@
 -- 2) 2007-07-22  	Add "SCHEMA" column to PGRASTER_METADATA table. (Xing)
 -- 3) 2007-07-30 	Add several functions and triggers to help create/modify/
 --					remove pgraster dataset in PGRASTER database. (Xing)
+-- 4) 2007-08-04 	Check validity for new schema name and table to be inserted.
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 --DEFINITION OF TYPE INFORMATION
 -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -129,9 +130,11 @@
 );
 INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(-1, 'CT_UNKNOWN','Unknown Compression Type');
 INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(0, 'CT_JPEG_B','JPEG-B Compression Type');
-INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(1, 'CT_JPEG_F','JPEG-F Compression Type');
-INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(2, 'CT_LZW','LZW/LZ77 Compression Type');
-INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(3, 'CT_NONE','UNCOMPRESSION/PLAIN Compression Type');
+INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(1, 'CT_JPEG_F3','JPEG-F3 Compression Type');
+INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(2, 'CT_JPEG_F4','JPEG-F3 Compression Type');
+INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(3, 'CT_LZW','LZW/LZ77 Compression Type');
+INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(4, 'CT_DEFLATE','Gzip/DEFLATE Compression Type');
+INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(5, 'CT_NONE','UNCOMPRESSION/PLAIN Compression Type');
 
 -- DEFINITION OF PGRASTER_METADATA
 
@@ -382,7 +385,7 @@
 		 OR (NOT (band_type >=-1 AND band_type <=4 ) )
 		 OR (NOT (value_type >=-1 AND value_type <=4 ) )
 		 OR (NOT (bil_type >=-1 AND bil_type<=2 ) )
-		 OR (NOT (compress_type>= -1 AND compress_type <= 3))
+		 OR (NOT (compress_type>= -1 AND compress_type <= 5))
 		)
 	THEN
 		RAISE EXCEPTION ''Invalid type ids - valid ones are: 
@@ -608,8 +611,21 @@
 DECLARE
 	schema 				alias for $1;
 	table 				alias for $2;
+	objectid 			INTEGER;
 BEGIN
 
+
+	-- Get Object ID
+	SELECT rasterObjectID::INTEGER INTO objectid FROM pgraster_metadata WHERE rasterSchema=schema AND rasterDataTable=table; 
+
+	IF (objectid IS NULL) THEN
+		--RAISE NOTICE ''No record in pgraster_metadata with schema=% and table=%'', schema,table;
+		RETURN ''TRUE'';
+	END IF;
+
+	-- Clear Other Foreign Key Dependency
+	EXECUTE ''DELETE FROM pgraster_srs WHERE rasterObjectID='' || objectid; 
+	
 	-- Clear metadata from pgraster metadata table.
 	EXECUTE ''DELETE FROM pgraster_metadata WHERE rasterSchema='' || quote_literal(schema) || '' AND rasterDataTable = '' || quote_literal(table); 
 	
@@ -643,6 +659,14 @@
 	-- Get Schema and Table from metadata table
 	SELECT rasterSchema, rasterDataTable INTO schema,table FROM pgraster_metadata WHERE rasterObjectID=object_id;
 
+	IF (schema IS NULL OR table is NULL) THEN
+		RAISE NOTICE ''No record in pgraster_metadata with rasterid=%'', object_id;
+		RETURN ''TRUE'';
+	END IF;
+
+	-- Clear Other Foreign Key Dependency
+	EXECUTE ''DELETE FROM pgraster_srs WHERE rasterObjectID='' || object_id; 
+
 	-- Clear metadata from pgraster metadata table.
 	EXECUTE ''DELETE FROM pgraster_metadata WHERE rasterObjectID='' || object_id;
 	
@@ -712,7 +736,7 @@
 BEGIN
 
 		
-	SELECT count(*) INTO count2 FROM pgraster_metadata WHERE rasterSchema=quote_literal(schema) AND rasterDataTable=quote_literal(table); 
+	SELECT count(*) INTO count2 FROM pgraster_metadata WHERE rasterSchema=schema AND rasterDataTable=table;
 
 	IF (count2 = 0) THEN
 		RAISE NOTICE ''No record in pgraster_metadata with schema=% and table=%.'', schema,table;
@@ -728,3 +752,32 @@
 END;
 '
 LANGUAGE 'plpgsql' VOLATILE STRICT; -- WITH (isstrict);
+
+--CheckRasterValidity(<schema>,<table>)
+CREATE OR REPLACE FUNCTION CheckRasterValidity(varchar,varchar)
+RETURNS BOOL
+AS
+'
+DECLARE
+
+	schema 	 		alias for $1;
+	table 			alias for $2;
+	count2 			INTEGER;
+	bValidate 		BOOL;
+
+BEGIN
+
+		
+	SELECT count(*) INTO count2 FROM public.pgraster_metadata WHERE rasterSchema=schema AND rasterDataTable=table;
+
+	IF (count2 = 0) THEN
+		bValidate := ''t'';
+	ELSE
+        bValidate := ''f''; 
+	END IF;
+
+	RETURN bValidate;
+
+END;
+'
+LANGUAGE 'plpgsql' VOLATILE STRICT; -- WITH (isstrict);

Modified: branches/gSoC2007_raster/pgraster/pgraster_const.h
===================================================================
--- branches/gSoC2007_raster/pgraster/pgraster_const.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/pgraster_const.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -64,7 +64,7 @@
 /* DEFINITION OF VALUE TYPE */
 typedef enum _ValueType
 {
-	VT_UNKNOWN 		= 	-1, // Unknown Value Type
+	VT_NOTHING 		= 	-1, // Unknown Value Type
 	VT_NOMINAL 		= 	0, 	// Nominal Value Type
     VT_ORDINAL 		= 	1, 	// Ordinal Value Type
     VT_INTERVAL 	= 	2, 	// Interval Value Type
@@ -89,7 +89,8 @@
 	CT_JPEG_F3 	= 	1, 		// JPEG-F3 Data Compression Type (JPEG Image compression)
 	CT_JPEG_F4  = 	2, 		// JPEG-F4 Data Compression Type
 	CT_LZW 		= 	3, 		// LZW/LZ77 Lossless Compressio Type
-	CT_NONE 	= 	4 		// No-Compression/Flat Data
+	CT_DEFLATE  = 	4, 		// LZW/LZ77 Lossless Compressio Type
+	CT_NONE 	= 	5 		// No-Compression/Flat Data
 }PGRasterCompressionType;
 
 #endif

Modified: branches/gSoC2007_raster/pgraster/pgraster_types.h
===================================================================
--- branches/gSoC2007_raster/pgraster/pgraster_types.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/pgraster_types.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -56,34 +56,44 @@
 typedef unsigned char byte;
 #endif
 
+#ifndef _UINT8
+#define _UINT8 1
+typedef unsigned char _uint8;
+#endif
+
+#ifndef _INT8
+#define _INT8 1
+typedef char _int8;
+#endif
+
 #ifndef _UINT32
 #define _UINT32 1
-typedef uint32_t uint32;
+typedef uint32_t _uint32;
 #endif
 
 #ifndef _INT32
 #define _INT32 1
-typedef int int32;
+typedef int _int32;
 #endif
 
 #ifndef _INT16
 #define _INT16 1
-typedef short int16;
+typedef short _int16;
 #endif
 
 #ifndef _UINT16
 #define _UINT16 1
-typedef unsigned short uint16;
+typedef unsigned short _uint16;
 #endif
 
 #ifndef _UINT64
 #define _UINT64 1
-typedef unsigned long uint64;
+typedef unsigned long long _uint64;
 #endif
 
 #ifndef _INT64
 #define _INT64 1
-typedef long int64;
+typedef long long _int64;
 #endif
 
 /* Definition of ColorRGB*/
@@ -106,56 +116,59 @@
 /* Definition of PGRASTER_METADATA structure*/
 typedef struct _pgraster_metadata
 {
-	int64			rasterObjectID;
+	_int64 			rasterObjectID;
 	char*			name;
 	char* 			captureDate;
-	uint16 			rasterDimensions;
-	uint16 			rasterBandType;
-	uint16 			rasterDataType;
-	uint16			rasterValueType;
+	_uint16 		rasterDimensions;
+	_uint16 		rasterBandType;
+	_uint16 		rasterDataType;
+	_uint16			rasterValueType;
 	char*			rasterSchema;
 	char* 			rasterDataTable;
-	uint32 			rasterBandCount;
-	uint32 			rasterRowCount;
-	uint32			rasterColumnCount;
-	uint32 			rasterCellDepth;
+	_uint32 		rasterBandCount;
+	_uint32 		rasterRowCount;
+	_uint32			rasterColumnCount;
+	_uint32 		rasterCellDepth;
 	bool			rasterPyramidEnabled;
-	uint32 			rasterPyramidDepth;
-	int32 			blockSizeBands;
-	int32 			blockSizeRows;
-	int32 			blockSizeColumns;
+	_uint32 		rasterPyramidDepth;
+	_int32 			blockSizeBands;
+	_int32 			blockSizeRows;
+	_int32 			blockSizeColumns;
 	bool			blockPadding;
- 	uint16 			blockBandInterleaving;
-	uint16 			blockCompression;
-	int32 			blockQuality;
+ 	_uint16 		blockBandInterleaving;
+	_uint16 		blockCompression;
+	_int32 			blockQuality;
 	double			nodataValue;
-	int32			SRID;
+	_int32			SRID;
 	bool			geoReferenced;
 	WKBGeometry*	spatialExtent;
+	double 			spatialResolutionX;
+	double 			spatialResolutionY;
+	double 			spatialResolutionZ;
 }PGRasterMetadata;
 
 /* Definition of PGRASTER_DATA*/
 typedef struct _pgraster_data
 {
-	int64			rasterObjectID;
-	int32			pyramidLevel;
-	int32 			bandBlockNumber;
-	int32 			rowBlockNumber;
-	int32 			columnBlockNumber;
-	int32			blockBandSize;
-	int32			blockRowSize;		
-	int32			blockColumnSize;	
+	_int64			rasterObjectID;
+	_int32			pyramidLevel;
+	_int32 			bandBlockNumber;
+	_int32 			rowBlockNumber;
+	_int32 			columnBlockNumber;
+	_int32			blockBandSize;
+	_int32			blockRowSize;		
+	_int32			blockColumnSize;	
 	WKBGeometry*	blockMBR;			// how to deal with geometry in postgresql.
 	byte*			dataBlock;			// map byte* into bytea in PostgreSQL.
-	int32			nDataLength; 		// only length of data block.
+	_int32			nDataLength; 		// only length of data block.
 }PGRasterData;
 
 
 /* Definition of PGRASTER_GCP */
 typedef struct _pgraster_gcp
 {
-	int64		rasterObjectID;
-	int64 		gcpID;
+	_int64		rasterObjectID;
+	_int64 		gcpID;
 	double 		cellColumn;
 	double 		cellRow;
 	double 		cellHeight;
@@ -169,15 +182,15 @@
 /* Definition of PGRASTER_SRS*/
 typedef struct _pgraster_srs
 {
-	int64		rasterObjectID;
+	_int64		rasterObjectID;
 	bool		isReferenced; 	  
 	bool	 	isOrthoRectified;  
-	int32		SRID;
+	_int32		SRID;
 	double 		spatialResolutionX;
 	double 		spatialResolutionY;
 	double		spatialResolutionZ;
 	double		spatialTolerance;
-	int16		coordLocation;
+	_int16		coordLocation;
 	double		rowOff;
 	double		columnOff;
 	double 		heightOff;
@@ -193,21 +206,21 @@
 	double		columnRMS;
 	double		totalRMS;
 	double		*rowNumberator;
-	int32 		countRowNumberator;
+	_int32 		countRowNumberator;
 	double		*rowDenominator;
-	int32		countRowDenominator;
+	_int32		countRowDenominator;
 	double		*columnNumerator;
-	int32		countColumnNumberator;
+	_int32		countColumnNumberator;
 	double		*columnDenominator;
-	int32		countColumnDenominator;
+	_int32		countColumnDenominator;
 }PGRasterSRS;
 
 
 /* Definition of PGRASTER_VAT */
 typedef struct _pgraster_vat
 {
-	int64 		rasterObjectID;
-	uint32		bandID;
+	_int64 		rasterObjectID;
+	_uint32		bandID;
 	double 		value;
 	char		*attribute;
 }PGRasterVAT;
@@ -216,8 +229,8 @@
 /* Definition of PGRASTER_STATISTICS */
 typedef struct _pgraster_stat
 {
-	int64		rasterObjectID;
-	uint32		bandID;
+	_int64		rasterObjectID;
+	_uint32		bandID;
 	double 		maxValue;
 	double 		minValue;
 	double 		avgValue;
@@ -229,8 +242,8 @@
 /* Definition of PGRASTER_HISTOGRAM */
 typedef struct _pgraster_histogram
 {
-	int64		rasterObjectID;
-	uint32		bandID;
+	_int64		rasterObjectID;
+	_uint32		bandID;
 	double 		value;
 	double 		count;
 }PGRasterHistogram;
@@ -238,11 +251,11 @@
 /* Definition of PGRASTER_PALETTE */
 typedef struct _pgraster_palette
 {
-	int32 		id;
+	_int32 		id;
 	char		*name;
 	char		*description;
-	int32		colorNumber;
-	int32		colorDepth; 	// could be ColorRGB or ColorRGBA.
+	_int32		colorNumber;
+	_int32		colorDepth; 	// could be ColorRGB or ColorRGBA.
 	byte		*colorData;
 }PGRasterPalette;
 

Modified: branches/gSoC2007_raster/pgraster/pgraster_utils.c
===================================================================
--- branches/gSoC2007_raster/pgraster/pgraster_utils.c	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/pgraster_utils.c	2007-08-17 22:46:15 UTC (rev 2696)
@@ -34,6 +34,7 @@
 #include "pgraster_utils.h"
 #include "pgraster_types.h"
 #include "pgraster_const.h"
+#include "math.h"
 
 /* Some byte data reading/seeking tools */
 void skipbyte(byte **c) {
@@ -58,14 +59,14 @@
 	return *((*c)++);
 }
 
-uint16 popuint16(byte **c) {
-	uint16 i=0;
+_uint16 popuint16(byte **c) {
+	_uint16 i=0;
 	memcpy(&i, *c, 2);
 	*c+=2;
 	return i;
 }
-uint16 readuint16(byte *c) {
-	uint16 i=0;
+_uint16 readuint16(byte *c) {
+	_uint16 i=0;
 	memcpy(&i, c, 2);
 	return i;
 }
@@ -73,14 +74,14 @@
 	*c+=2;
 }
 
-int16 popint16(byte **c) {
-	int16 i=0;
+_int16 popint16(byte **c) {
+	_int16 i=0;
 	memcpy(&i, *c, 2);
 	*c+=2;
 	return i;
 }
-int16 readint16(byte *c) {
-	int16 i=0;
+_int16 readint16(byte *c) {
+	_int16 i=0;
 	memcpy(&i, c, 2);
 	return i;
 }
@@ -88,14 +89,14 @@
 	*c+=2;
 }
 
-uint32 popuint32(byte **c) {
-	uint32 i=0;
+_uint32 popuint32(byte **c) {
+	_uint32 i=0;
 	memcpy(&i, *c, 4);
 	*c+=4;
 	return i;
 }
-uint32 readuint32(byte *c) {
-	uint32 i=0;
+_uint32 readuint32(byte *c) {
+	_uint32 i=0;
 	memcpy(&i, c, 4);
 	return i;
 }
@@ -103,14 +104,14 @@
 	*c+=4;
 }
 
-int32 popint32(byte **c) {
-	int32 i=0;
+_int32 popint32(byte **c) {
+	_int32 i=0;
 	memcpy(&i, *c, 4);
 	*c+=4;
 	return i;
 }
-int32 readint32(byte *c) {
-	int32 i=0;
+_int32 readint32(byte *c) {
+	_int32 i=0;
 	memcpy(&i, c, 4);
 	return i;
 }
@@ -195,7 +196,7 @@
 	pgrMeta->rasterDimensions = 0;
 	pgrMeta->rasterBandType = BT_UNKNOWN;
 	pgrMeta->rasterDataType = DT_UNKNOWN;
-	pgrMeta->rasterValueType = VT_UNKNOWN;
+	pgrMeta->rasterValueType = VT_NOTHING;
 	pgrMeta->rasterDataTable = "PGRASTER_DATA\0";
 	pgrMeta->rasterBandCount = 0;
 	pgrMeta->rasterRowCount = 0;
@@ -251,3 +252,229 @@
 	for (j=0; j<strlen(s); j++) s[j] = toupper(s[j]);
 }
 
+_uint32 CalculatePyramidDepth(_uint32 rows, _uint32 cols, _uint32 blockSizeRow, _uint32 blockSizeColumn)
+{
+	if(cols == 0 || rows == 0)
+		return 1;
+	else
+	{	
+		_uint32 nBlockHorizontal = 0;
+		_uint32 nBlockVertical = 0;
+		_uint32 nPyramidDepth = 1;
+		_uint32 nBiggerBlock = 0;
+		_uint32 nLowerWidth = 0 ;
+		_uint32 nBlocks = 0;
+		int n,l;
+
+		nBlockHorizontal = (int)((cols%blockSizeColumn) == 0? (cols/blockSizeColumn):(cols/blockSizeColumn + 1));
+		nBlockVertical = (int)((rows%blockSizeRow) == 0? (rows/blockSizeRow):(rows/blockSizeRow + 1));
+		nBiggerBlock = (nBlockHorizontal>nBlockVertical)?nBlockHorizontal:nBlockVertical;
+		nLowerWidth  = (rows>cols)?cols:rows;
+		nBlocks = nBiggerBlock;
+		
+		for(l = 0 ; ;l++)
+		{
+			if(pow(2,l) >= nBlocks)
+				break;
+			else 
+				continue;
+		}
+	
+		for(n = 0;;n++)
+		{
+			if(pow(2,n) >= nLowerWidth)
+				break;
+			else
+				continue;
+		}
+		
+		nPyramidDepth = ((n > l)?l:n)+1;
+
+		return nPyramidDepth;
+
+	}
+}
+
+byte SetSingleBitAt(byte in, byte bit, byte pos)
+{
+	if(bit == 0)
+		in = ~in;
+	if(pos == 0)
+		in = (in | 128);
+	else if (pos == 1)
+		in = (in | 64 );
+	else if (pos == 2)
+		in = (in | 32 );
+	else if (pos == 3)
+		in = (in | 16 );
+	else if (pos == 4)
+		in = (in | 8 );
+	else if (pos == 5)
+		in = (in | 4 );
+	else if (pos == 6)
+		in = (in | 2 );
+	else // if (pos == 7)
+		in = (in | 2);
+
+	if(bit == 0)
+		in = ~in;
+
+	return in;
+}
+
+// To Be Finish.
+byte GetSingleBitAt(byte in, byte pos)
+{
+	if(pos >= 8)
+		return 0;
+	else
+	{
+		return (in<<pos)>>7;
+	}
+}
+
+byte SetMultiBitAt(byte in, byte bits, byte count, byte pos)
+{
+	return in;
+	/*
+	if(count == 1)
+	{
+		return SetSingleBitAt(in, bits, pos);
+	}
+	else if(count == 2 && pos <= 6)
+	{
+		bits = bits << (6-pos);
+		  
+	}
+	else if(count == 3 && pos <= 5)
+	{
+		
+	}
+	else if(count == 4 && pos <= 4)
+	{
+		
+	}
+	else if(count == 5 && pos <= 3)
+	{
+		
+	}
+	else if(count == 6 && pos <= 2)
+	{
+		
+	}
+	else if(count == 7 && pos <= 1)
+	{
+		
+	}
+	else if(count == 8)
+		return bits;
+	else 
+		return in;
+	*/
+}
+
+byte GetMultiBitAt(byte in, byte pos, byte count)
+{
+	if( pos > 7 )
+		return 0;
+	else if ((pos+count) > 8)
+		return 0;
+	else
+	{
+		return (in<<pos)>>(8-count);		
+	}
+}
+
+/* ntoh, ntol and so on*/
+
+_uint16 _htons(_uint16 n)
+{
+  	return ((n & 0xFF) << 8) | ((n & 0xFF00) >> 8);
+}
+
+_uint16 _ntohs(_uint16 n)
+{
+  	return ((n & 0xFF) << 8) | ((n & 0xFF00) >> 8);
+}
+
+_uint32 _htonl(_uint32 n)
+{
+  	return ((n & 0xFF) << 24) | ((n & 0xFF00) << 8) | ((n & 0xFF0000) >> 8) | ((n & 0xFF000000) >> 24);
+}
+
+_uint32 _ntohl(_uint32 n)
+{
+  	return ((n & 0xFF) << 24) | ((n & 0xFF00) << 8) | ((n & 0xFF0000) >> 8) | ((n & 0xFF000000) >> 24);
+}
+
+_uint64 _htonll(_uint64 n)
+{
+  	//return ((n & 0xFF) << 56) | ((n & 0xFF00) << 8) | ((n & 0xFF0000) >> 8) | ((n & 0xFF000000) >> 24);
+	return ((_uint64)(_ntohl((_uint32)((n << 32) >> 32))) << 32) | (_uint32)_ntohl(((int)(n >> 32)));
+ 
+}
+
+_uint64 _ntohll(_uint64 n)
+{
+ 	return _htonll(n); 
+}
+
+double _htond(double f)
+{
+    union
+	{
+		double		f;
+		_uint32		h[2];
+	}swap;
+
+	swap.f = f;
+	swap.h[0] = _htonl(swap.h[0]);
+	swap.h[1] = _htonl(swap.h[1]);
+
+    return swap.f;
+}
+
+double _ntohd(double f)
+{
+    union
+	{
+		double		f;
+		_uint32		h[2];
+	}swap;
+
+	swap.f = f;
+	swap.h[0] = _htonl(swap.h[0]);
+	swap.h[1] = _htonl(swap.h[1]);
+
+    return swap.f;
+}
+
+float _htonf(float f)
+{
+    union
+	{
+		double		f;
+		_uint32		i;
+	}swap;
+
+	swap.f = f;
+	swap.i = _htonl(swap.i);
+
+    return swap.f;
+}
+
+float _ntohf(float f)
+{
+    union
+	{
+		double		f;
+		_uint32		i;
+	}swap;
+
+	swap.f = f;
+	swap.i = _ntohl(swap.i);
+
+    return swap.f;
+}
+
+

Modified: branches/gSoC2007_raster/pgraster/pgraster_utils.h
===================================================================
--- branches/gSoC2007_raster/pgraster/pgraster_utils.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/pgraster_utils.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -61,20 +61,20 @@
 void skipchar(byte **c);
 char popchar(byte **c);
 
-uint16 popuint16(byte **c);
-uint16 readuint16(byte *c);
+_uint16 popuint16(byte **c);
+_uint16 readuint16(byte *c);
 void skipuint16(byte **c);
 
-int16 popint16(byte **c);
-int16 readint16(byte *c);
+_int16 popint16(byte **c);
+_int16 readint16(byte *c);
 void skipint16(byte **c);
 
-uint32 popuint32(byte **c);
-uint32 readuint32(byte *c);
+_uint32 popuint32(byte **c);
+_uint32 readuint32(byte *c);
 void skipuint32(byte **c);
 
-int32 popint32(byte **c);
-int32 readint32(byte *c);
+_int32 popint32(byte **c);
+_int32 readint32(byte *c);
 void skipint32(byte **c);
 
 float readfloat(byte *c);
@@ -103,4 +103,62 @@
 void LowerCase(char *s);
 void UpperCase(char *s);
 
+/* Calculate Pyramid Depth */
+_uint32 CalculatePyramidDepth(_uint32 rows, _uint32 columns, _uint32 blockSizeRow, _uint32 blockSizeColumn);
+
+/* Set Bit / Bits at */
+byte SetSingleBitAt(byte in, byte bit, byte pos);
+
+byte SetMultiBitAt(byte in, byte bits, byte count, byte pos);
+
+byte GetSingleBitAt(byte in,byte pos);
+
+byte GetMultiBitAt(byte in, byte pos, byte count);
+
+/* ntoh, ntol and so on*/
+
+_uint16 _htons(_uint16 n);
+
+
+_uint16 _ntohs(_uint16 n);
+
+_uint32 _htonl(_uint32 n);
+
+_uint32 _ntohl(_uint32 n);
+
+_uint64 _htonll(_uint64 n);
+
+_uint64 _ntohll(_uint64 n);
+
+uint32_t _htonf_(float f);
+
+float _ntohf_(uint32_t p);
+
+/*************************************************************************\
+* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
+*     National Laboratory.
+* Copyright (c) 2002 The Regents of the University of California, as
+*     Operator of Los Alamos National Laboratory.
+* EPICS BASE Versions 3.13.7
+* and higher are distributed subject to a Software License Agreement found
+* in file LICENSE that is included with this distribution. 
+\*************************************************************************/
+
+/*
+ * mitfp.c - routines to convert between VAX float and big endian
+ * 		IEEE float
+ *
+ * Author: Jeffrey O. Hill
+ *
+ *
+ */
+
+float _ntohf(float ieee);
+
+float _htonf(float mit);
+
+double _ntohlf(double ieee);
+
+double _htonlf(double mit);
+
 #endif

Added: branches/gSoC2007_raster/pgraster/win32/build/README
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/build/README	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/build/README	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,10 @@
+1. Import and run SQL script in pgraster.sql.
+
+2. In MS Command, run geotiff2pgraster to import GeoTIFF data into PostgreSQL/PostGIS.
+
+3. ask for help from geotiff2pgraster -?
+
+Thanks for testing.
+
+Xing Lin. 
+2007-08-17

Added: branches/gSoC2007_raster/pgraster/win32/build/UTM2GTIF.TIF
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/build/UTM2GTIF.TIF
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/build/geotiff.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/build/geotiff.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/build/geotiff2pgraster.exe
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/build/geotiff2pgraster.exe
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/build/glut32.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/build/glut32.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/build/jpeg62.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/build/jpeg62.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/build/libimage.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/build/libimage.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/build/libpng13.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/build/libpng13.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/build/libtiff.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/build/libtiff.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/build/zlib1.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/build/zlib1.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/README.txt
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/README.txt	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/README.txt	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,25 @@
+GeoTIFF Development Kit
+-----------------------
+
+This is intended to be a very simple binary distribution of the 
+libraries needed to build GeoTIFF applications using libtiff and
+libgeotiff on Win32.
+
+o Requires MS Visual C++ or compatible tools
+
+o Add geotiff_dev/include to your include path. 
+
+o Add geotiff_dev/lib/geotiff_i.lib and geotiff_dev/lib/libtiff_i.lib
+  to your link.
+
+o Include geotiff_dev/bin/geotiff.dll and geotiff_dev/bin/libtiff.dll
+  to your path. 
+
+A simple example build is demonstrated in geotiff_dev/example using
+the build.bat file. 
+
+Good luck!
+
+Frank Warmerdam (http://pobox.com/~warmerdam)
+
+

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/geotiff.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/geotiff.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/glut32.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/glut32.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/jpeg62.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/jpeg62.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/libimage.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/libimage.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/libpng13.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/libpng13.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/libtiff.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/libtiff.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/zlib1.dll
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/bin/zlib1.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/example/build.bat
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/example/build.bat	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/example/build.bat	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1 @@
+cl /I../include listgeo.c ../lib/geotiff_i.lib ../lib/libtiff_i.lib

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/example/listgeo.c
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/example/listgeo.c	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/example/listgeo.c	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,333 @@
+/*
+ * listgeo.c -- example client code for LIBGEO geographic
+ *     TIFF tag support. Dumps info to GeoTIFF metadata file.
+ *
+ *  Author: Niles D. Ritter
+ *
+ */
+
+#include "geotiff.h"
+#include "xtiffio.h"
+#include "geo_normalize.h"
+#include "geovalues.h"
+#include "tiffio.h"
+#include <stdio.h>
+
+static void WriteTFWFile( GTIF * gtif, const char * tif_filename );
+static void GTIFPrintCorners( GTIF *, GTIFDefn *, FILE *, int, int, int, int );
+static const char *CSVFileOverride( const char * );
+static const char *CSVDirName = NULL;
+
+void Usage()
+
+{
+    printf( 
+        "%s", 
+        "Usage: listgeo [-d] [-tfw] [-proj4] [-no_norm] [-t tabledir] filename\n"
+        "\n"
+        "  -d: report lat/long corners in decimal degrees instead of DMS.\n"
+        "  -tfw: Generate a .tfw (ESRI TIFF World) file for the target file.\n"
+        "  -proj4: Report PROJ.4 equivelent projection definition.\n"
+        "  -no_norm: Don't report 'normalized' parameter values.\n"
+        "  filename: Name of the GeoTIFF file to report on.\n" );
+        
+    exit( 1 );
+}
+
+int main(int argc, char *argv[])
+{
+    char	*fname = NULL;
+    TIFF 	*tif=(TIFF*)0;  /* TIFF-level descriptor */
+    GTIF	*gtif=(GTIF*)0; /* GeoKey-level descriptor */
+    int		i, norm_print_flag = 1, proj4_print_flag = 0;
+    int		tfw_flag = 0, inv_flag = 0, dec_flag = 0;
+
+    /*
+     * Handle command line options.
+     */
+    for( i = 1; i < argc; i++ )
+    {
+        if( strcmp(argv[i],"-no_norm") == 0 )
+            norm_print_flag = 0;
+        else if( strcmp(argv[i],"-t") == 0 )
+        {
+            CSVDirName = argv[++i];
+            SetCSVFilenameHook( CSVFileOverride );
+        }
+        else if( strcmp(argv[i],"-tfw") == 0 )
+            tfw_flag = 1;
+        else if( strcmp(argv[i],"-proj4") == 0 )
+            proj4_print_flag = 1;
+        else if( strcmp(argv[i],"-i") == 0 )
+            inv_flag = 1;
+        else if( strcmp(argv[i],"-d") == 0 )
+            dec_flag = 1;
+        else if( fname == NULL && argv[i][0] != '-' )
+            fname = argv[i];
+        else
+        {
+            Usage();
+        }
+    }
+
+    if( fname == NULL )
+        Usage();
+
+    /*
+     * Open the file, read the GeoTIFF information, and print to stdout. 
+     */
+
+    tif=XTIFFOpen(fname,"r");
+    if (!tif) goto failure;
+	
+    gtif = GTIFNew(tif);
+    if (!gtif)
+    {
+        fprintf(stderr,"failed in GTIFNew\n");
+        goto failure;
+    }
+
+    if( tfw_flag )
+    {
+        WriteTFWFile( gtif, fname );
+
+        goto Success;
+    }
+	
+    /* dump the GeoTIFF metadata to std out */
+
+    GTIFPrint(gtif,0,0);
+
+    /*
+     * Capture, and report normalized information if requested.
+     */
+
+    if( norm_print_flag )
+    {
+        GTIFDefn	defn;
+        
+        if( GTIFGetDefn( gtif, &defn ) )
+        {
+            int		xsize, ysize;
+            
+            printf( "\n" );
+            GTIFPrintDefn( &defn, stdout );
+
+            if( proj4_print_flag )
+            {
+                printf( "\n" );
+                printf( "PROJ.4 Definition: %s\n", GTIFGetProj4Defn(&defn));
+            }
+            
+            TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &xsize );
+            TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &ysize );
+            GTIFPrintCorners( gtif, &defn, stdout, xsize, ysize, inv_flag, dec_flag );
+        }
+
+    }
+
+  Success:
+    GTIFFree(gtif);
+    XTIFFClose(tif);
+    return 0;
+		
+  failure:
+    fprintf(stderr,"failure in listgeo\n");
+    if (tif) XTIFFClose(tif);
+    if (gtif) GTIFFree(gtif);
+    return 1;
+}
+
+static const char *CSVFileOverride( const char * pszInput )
+
+{
+    static char		szPath[1024];
+
+#ifdef WIN32
+    sprintf( szPath, "%s\\%s", CSVDirName, pszInput );
+#else    
+    sprintf( szPath, "%s/%s", CSVDirName, pszInput );
+#endif    
+
+    return( szPath );
+}
+
+const char *GTIFDecToDDec( double dfAngle, const char * pszAxis,
+                          int nPrecision )
+
+{
+    char        szFormat[30];
+    static char szBuffer[50];
+    const char  *pszHemisphere = NULL;
+
+    if( EQUAL(pszAxis,"Long") && dfAngle < 0.0 )
+        pszHemisphere = "W";
+    else if( EQUAL(pszAxis,"Long") )
+        pszHemisphere = "E";
+    else if( dfAngle < 0.0 )
+        pszHemisphere = "S";
+    else
+        pszHemisphere = "N";
+
+    sprintf( szFormat, "%%3.%df%s",
+             nPrecision, pszHemisphere );
+    sprintf( szBuffer, szFormat, dfAngle );
+
+    return( szBuffer );
+}
+
+/*
+ * Report the file(s) corner coordinates in projected coordinates, and
+ * if possible lat/long.
+ */
+
+static int GTIFReportACorner( GTIF *gtif, GTIFDefn *defn, FILE * fp_out,
+                              const char * corner_name,
+                              double x, double y, int inv_flag, int dec_flag )
+
+{
+    double	x_saved, y_saved;
+
+    /* Try to transform the coordinate into PCS space */
+    if( !GTIFImageToPCS( gtif, &x, &y ) )
+        return FALSE;
+    
+    x_saved = x;
+    y_saved = y;
+
+    fprintf( fp_out, "%-13s ", corner_name );
+
+    if( defn->Model == ModelTypeGeographic )
+    {
+	if (dec_flag) 
+	{
+	    fprintf( fp_out, "(%s,", GTIFDecToDDec( x, "Long", 4 ) );
+	    fprintf( fp_out, "%s)\n", GTIFDecToDDec( y, "Lat", 4 ) );
+	} 
+	else 
+	{
+	    fprintf( fp_out, "(%s,", GTIFDecToDMS( x, "Long", 2 ) );
+	    fprintf( fp_out, "%s)\n", GTIFDecToDMS( y, "Lat", 2 ) );
+	}
+    }
+    else
+    {
+        fprintf( fp_out, "(%11.3f,%11.3f)", x, y );
+
+        if( GTIFProj4ToLatLong( defn, 1, &x, &y ) )
+        {
+	    if (dec_flag) 
+	    {
+		fprintf( fp_out, "  (%s,", GTIFDecToDDec( x, "Long", 4 ) );
+		fprintf( fp_out, "%s)\n", GTIFDecToDDec( y, "Lat", 4 ) );
+	    } 
+	    else 
+	    {
+		fprintf( fp_out, "  (%s,", GTIFDecToDMS( x, "Long", 2 ) );
+		fprintf( fp_out, "%s)", GTIFDecToDMS( y, "Lat", 2 ) );
+	    }
+        }
+
+        fprintf( fp_out, "\n" );
+    }
+
+    if( inv_flag && GTIFPCSToImage( gtif, &x_saved, &y_saved ) )
+    {
+        fprintf( fp_out, "      inverse (%11.3f,%11.3f)\n", x_saved, y_saved );
+    }
+    
+    return TRUE;
+}
+
+static void GTIFPrintCorners( GTIF *gtif, GTIFDefn *defn, FILE * fp_out,
+                              int xsize, int ysize, int inv_flag, int dec_flag )
+
+{
+    printf( "\nCorner Coordinates:\n" );
+    if( !GTIFReportACorner( gtif, defn, fp_out,
+                            "Upper Left", 0.0, 0.0, inv_flag, dec_flag ) )
+    {
+        printf( " ... unable to transform points between pixel/line and PCS space\n" );
+        return;
+    }
+
+    GTIFReportACorner( gtif, defn, fp_out, "Lower Left", 0.0, ysize, 
+                       inv_flag, dec_flag );
+    GTIFReportACorner( gtif, defn, fp_out, "Upper Right", xsize, 0.0,
+                       inv_flag, dec_flag );
+    GTIFReportACorner( gtif, defn, fp_out, "Lower Right", xsize, ysize,
+                       inv_flag, dec_flag );
+    GTIFReportACorner( gtif, defn, fp_out, "Center", xsize/2.0, ysize/2.0,
+                       inv_flag, dec_flag );
+}
+
+/*
+ * Write the defining matrix for this file to a .tfw file with the same
+ * basename.
+ */
+
+static void WriteTFWFile( GTIF * gtif, const char * tif_filename )
+
+{
+    char	tfw_filename[1024];
+    int		i;
+    double	adfCoeff[6], x, y;
+    FILE	*fp;
+
+    /*
+     * form .tfw filename
+     */
+    strncpy( tfw_filename, tif_filename, sizeof(tfw_filename)-4 );
+    for( i = strlen(tfw_filename)-1; i > 0; i-- )
+    {
+        if( tfw_filename[i] == '.' )
+        {
+            strcpy( tfw_filename + i, ".tfw" );
+            break;
+        }
+    }
+
+    if( i <= 0 )
+        strcat( tfw_filename, ".tfw" );
+
+    /*
+     * Compute the coefficients.
+     */
+    x = 0.5;
+    y = 0.5;
+    if( !GTIFImageToPCS( gtif, &x, &y ) )
+        return;
+    adfCoeff[4] = x;
+    adfCoeff[5] = y;
+
+    x = 1.5;
+    y = 0.5;
+    if( !GTIFImageToPCS( gtif, &x, &y ) )
+        return;
+    adfCoeff[0] = x - adfCoeff[4];
+    adfCoeff[1] = y - adfCoeff[5];
+
+    x = 0.5;
+    y = 1.5;
+    if( !GTIFImageToPCS( gtif, &x, &y ) )
+        return;
+    adfCoeff[2] = x - adfCoeff[4];
+    adfCoeff[3] = y - adfCoeff[5];
+
+    /*
+     * Write out the coefficients.
+     */
+
+    fp = fopen( tfw_filename, "wt" );
+    if( fp == NULL )
+    {
+        perror( "fopen" );
+        fprintf( stderr, "Failed to open TFW file `%s'\n", tfw_filename );
+        return;
+    }
+
+    for( i = 0; i < 6; i++ )
+        fprintf( fp, "%24.10f\n", adfCoeff[i] );
+
+    fclose( fp );
+}

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/example/listgeo.exe
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/example/listgeo.exe
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/example/listgeo.obj
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/example/listgeo.obj
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/cpl_serv.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/cpl_serv.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/cpl_serv.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,276 @@
+/******************************************************************************
+ * Copyright (c) 1998, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ *
+ * cpl_serv.h
+ *
+ * This include file derived and simplified from the GDAL Common Portability
+ * Library.
+ */
+
+#ifndef CPL_SERV_H_INCLUDED
+#define CPL_SERV_H_INCLUDED
+
+/* ==================================================================== */
+/*	Standard include files.						*/
+/* ==================================================================== */
+
+#include "geo_config.h"
+#include <stdio.h>
+
+#include <math.h>
+
+#ifdef HAVE_STRING_H
+#  include <string.h>
+#endif
+#if defined(HAVE_STRINGS_H) && !defined(HAVE_STRING_H)
+#  include <strings.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+#endif
+
+/**********************************************************************
+ * Do we want to build as a DLL on windows?
+ **********************************************************************/
+#if !defined(CPL_DLL)
+#  if defined(_WIN32) && defined(BUILD_AS_DLL)
+#    define CPL_DLL     __declspec(dllexport)
+#  else
+#    define CPL_DLL
+#  endif
+#endif
+
+/* ==================================================================== */
+/*      Other standard services.                                        */
+/* ==================================================================== */
+#ifdef __cplusplus
+#  define CPL_C_START		extern "C" {
+#  define CPL_C_END		}
+#else
+#  define CPL_C_START
+#  define CPL_C_END
+#endif
+
+#ifndef NULL
+#  define NULL	0
+#endif
+
+#ifndef FALSE
+#  define FALSE	0
+#endif
+
+#ifndef TRUE
+#  define TRUE	1
+#endif
+
+#ifndef MAX
+#  define MIN(a,b)      ((a<b) ? a : b)
+#  define MAX(a,b)      ((a>b) ? a : b)
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef ABS
+#  define ABS(x)        ((x<0) ? (-1*(x)) : x)
+#endif
+
+#ifndef EQUAL
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#  define EQUALN(a,b,n)           (strnicmp(a,b,n)==0)
+#  define EQUAL(a,b)              (stricmp(a,b)==0)
+#else
+#  define EQUALN(a,b,n)           (strncasecmp(a,b,n)==0)
+#  define EQUAL(a,b)              (strcasecmp(a,b)==0)
+#endif
+#endif
+
+/* ==================================================================== */
+/*      VSI Services (just map directly onto Standard C services.       */
+/* ==================================================================== */
+
+#define VSIFOpen	fopen
+#define VSIFClose	fclose
+#define VSIFEof		feof
+#define VSIFPrintf	fprintf
+#define VSIFPuts	fputs
+#define VSIFPutc	fputc
+#define VSIFGets	fgets
+#define VSIRewind	rewind
+#define VSIFSeek        fseek
+#define VSIFTell        ftell
+#define VSIFRead        fread
+
+#ifndef notdef
+#define VSICalloc(x,y)	_GTIFcalloc(x*y)
+#define VSIMalloc	_GTIFcalloc
+#define VSIFree	        _GTIFFree
+#define VSIRealloc      _GTIFrealloc
+#else
+#define VSICalloc(x,y)	(((char *) _GTIFcalloc(x*y+4)) + 4)
+#define VSIMalloc(x)	(((char *) _GTIFcalloc((x)+4)) + 4)
+#define VSIFree(x)      _GTIFFree(((char *) (x)) - 4)
+#define VSIRealloc(p,n) (((char *) _GTIFrealloc(((char *)p)-4,(n)+4)) + 4)
+#endif
+
+/* -------------------------------------------------------------------- */
+/*      Safe malloc() API.  Thin cover over VSI functions with fatal    */
+/*      error reporting if memory allocation fails.                     */
+/* -------------------------------------------------------------------- */
+CPL_C_START
+
+#define CPLMalloc  gtCPLMalloc
+#define CPLCalloc  gtCPLCalloc
+#define CPLRealloc gtCPLRealloc
+#define CPLStrdup  gtCPLStrdup
+
+void  *CPLMalloc( int );
+void  *CPLCalloc( int, int );
+void  *CPLRealloc( void *, int );
+char  *CPLStrdup( const char * );
+
+#define CPLFree(x)	{ if( x != NULL ) VSIFree(x); }
+
+/* -------------------------------------------------------------------- */
+/*      Read a line from a text file, and strip of CR/LF.               */
+/* -------------------------------------------------------------------- */
+
+#define CPLReadLine gtCPLReadLine
+
+const char *CPLReadLine( FILE * );
+
+/*=====================================================================
+                   Error handling functions (cpl_error.c)
+ =====================================================================*/
+
+typedef enum
+{
+    CE_None = 0,
+    CE_Log = 1,
+    CE_Warning = 2,
+    CE_Failure = 3,
+    CE_Fatal = 4
+} CPLErr;
+
+#define CPLError      gtCPLError
+#define CPLErrorReset gtCPLErrorReset
+#define CPLGetLastErrorNo gtCPLGetLastErrorNo
+#define CPLGetLastErrorMsg gtCPLGetLastErrorMsg
+#define CPLSetErrorHandler gtCPLSetErrorHandler
+#define _CPLAssert    gt_CPLAssert
+
+void  CPLError(CPLErr eErrClass, int err_no, const char *fmt, ...);
+void  CPLErrorReset();
+int   CPLGetLastErrorNo();
+const char  * CPLGetLastErrorMsg();
+void  CPLSetErrorHandler(void(*pfnErrorHandler)(CPLErr,int,
+                                                       const char *));
+void  _CPLAssert( const char *, const char *, int );
+
+#ifdef DEBUG
+#  define CPLAssert(expr)  ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__))
+#else
+#  define CPLAssert(expr)
+#endif
+
+CPL_C_END
+
+/* ==================================================================== */
+/*      Well known error codes.                                         */
+/* ==================================================================== */
+
+#define CPLE_AppDefined			1
+#define CPLE_OutOfMemory		2
+#define CPLE_FileIO			3
+#define CPLE_OpenFailed			4
+#define CPLE_IllegalArg			5
+#define CPLE_NotSupported		6
+#define CPLE_AssertionFailed		7
+#define CPLE_NoWriteAccess		8
+
+/*=====================================================================
+                   Stringlist functions (strlist.c)
+ =====================================================================*/
+CPL_C_START
+
+#define CSLAddString gtCSLAddString
+#define CSLCount     gtCSLCount
+#define CSLGetField  gtCSLGetField
+#define CSLDestroy   gtCSLDestroy
+#define CSLDuplicate gtCSLDuplicate
+#define CSLTokenizeString gtCSLTokenizeString
+#define CSLTokenizeStringComplex gtCSLTokenizeStringComplex
+
+char    **CSLAddString(char **papszStrList, const char *pszNewString);
+int     CSLCount(char **papszStrList);
+const char *CSLGetField( char **, int );
+void    CSLDestroy(char **papszStrList);
+char    **CSLDuplicate(char **papszStrList);
+
+char    **CSLTokenizeString(const char *pszString );
+char    **CSLTokenizeStringComplex(const char *pszString,
+                                   const char *pszDelimiter,
+                                   int bHonourStrings, int bAllowEmptyTokens );
+
+/* ==================================================================== */
+/*      .csv file related functions (from cpl_csv.c)                    */
+/* ==================================================================== */
+
+typedef enum {
+    CC_ExactString,
+    CC_ApproxString,
+    CC_Integer
+} CSVCompareCriteria;
+
+#define CSVFilename gtCSVFilename
+#define CSVReadParseLine gtCSVReadParseLine
+#define CSVScanLines gtCSVScanLines
+#define CSVScanFile gtCSVScanFile
+#define CSVScanFileByName gtCSVScanFileByName
+#define CSVGetFieldId gtCSVGetFieldId
+#define CSVDeaccess gtCSVDeaccess
+#define CSVGetField gtCSVGetField
+#define SetCSVFilenameHook gtSetCSVFilenameHook
+#define CSVGetFileFieldId gtCSVGetFileFieldId
+
+const char  *CSVFilename( const char * );
+
+char  **CSVReadParseLine( FILE * );
+char  **CSVScanLines( FILE *, int, const char *, CSVCompareCriteria );
+char  **CSVScanFile( const char *, int, const char *,
+                            CSVCompareCriteria );
+char  **CSVScanFileByName( const char *, const char *, const char *,
+                                  CSVCompareCriteria );
+int  CSVGetFieldId( FILE *, const char * );
+int  CSVGetFileFieldId( const char *, const char * );
+
+void  CSVDeaccess( const char * );
+
+const char  *CSVGetField( const char *, const char *, const char *,
+                                 CSVCompareCriteria, const char * );
+
+void CPL_DLL SetCSVFilenameHook( const char *(*)(const char *) );
+
+CPL_C_END
+
+#endif /* ndef CPL_SERV_H_INCLUDED */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/defs.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/defs.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/defs.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,13 @@
+
+/*
+ * This file is included by the CSV ".c" files in the csv directory.
+ */
+
+#include <stdio.h>
+
+/* Data structures */
+typedef const char * datafile_rows_t;
+typedef struct datafile_s {
+  const char *name;
+  const datafile_rows_t **rows; 
+} datafile_t;

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_datum.inc
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_datum.inc	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_datum.inc	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,174 @@
+/*
+ *  EPSG/POSC Datum database -- GeoTIFF Rev. 0.2
+ */
+ 
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_datum.inc
+#endif /* OLD Codes */
+
+/* New datums */
+ValuePair(Datum_Dealul_Piscului_1970,6317)
+
+/* Datums for which only the ellipsoid is known */
+ValuePair(DatumE_Airy1830,	6001)
+ValuePair(DatumE_AiryModified1849,	6002)
+ValuePair(DatumE_AustralianNationalSpheroid,	6003)
+ValuePair(DatumE_Bessel1841,	6004)
+ValuePair(DatumE_BesselModified,	6005)
+ValuePair(DatumE_BesselNamibia,	6006)
+ValuePair(DatumE_Clarke1858,	6007)
+ValuePair(DatumE_Clarke1866,	6008)
+ValuePair(DatumE_Clarke1866Michigan,	6009)
+ValuePair(DatumE_Clarke1880_Benoit,	6010)
+ValuePair(DatumE_Clarke1880_IGN,	6011)
+ValuePair(DatumE_Clarke1880_RGS,	6012)
+ValuePair(DatumE_Clarke1880_Arc,	6013)
+ValuePair(DatumE_Clarke1880_SGA1922,	6014)
+ValuePair(DatumE_Everest1830_1937Adjustment,	6015)
+ValuePair(DatumE_Everest1830_1967Definition,	6016)
+ValuePair(DatumE_Everest1830_1975Definition,	6017)
+ValuePair(DatumE_Everest1830Modified,	6018)
+ValuePair(DatumE_GRS1980,	6019)
+ValuePair(DatumE_Helmert1906,	6020)
+ValuePair(DatumE_IndonesianNationalSpheroid,	6021)
+ValuePair(DatumE_International1924,	6022)
+ValuePair(DatumE_International1967,	6023)
+ValuePair(DatumE_Krassowsky1960,	6024)
+ValuePair(DatumE_NWL9D,	6025)
+ValuePair(DatumE_NWL10D,	6026)
+ValuePair(DatumE_Plessis1817,	6027)
+ValuePair(DatumE_Struve1860,	6028)
+ValuePair(DatumE_WarOffice,	6029)
+ValuePair(DatumE_WGS84,	6030)
+ValuePair(DatumE_GEM10C,	6031)
+ValuePair(DatumE_OSU86F,	6032)
+ValuePair(DatumE_OSU91A,	6033)
+ValuePair(DatumE_Clarke1880,	6034)
+ValuePair(DatumE_Sphere,	6035)
+
+/* standard datums */
+ValuePair(Datum_Adindan,	6201)
+ValuePair(Datum_Australian_Geodetic_Datum_1966,	6202)
+ValuePair(Datum_Australian_Geodetic_Datum_1984,	6203)
+ValuePair(Datum_Ain_el_Abd_1970,	6204)
+ValuePair(Datum_Afgooye,	6205)
+ValuePair(Datum_Agadez,	6206)
+ValuePair(Datum_Lisbon,	6207)
+ValuePair(Datum_Aratu,	6208)
+ValuePair(Datum_Arc_1950,	6209)
+ValuePair(Datum_Arc_1960,	6210)
+ValuePair(Datum_Batavia,	6211)
+ValuePair(Datum_Barbados,	6212)
+ValuePair(Datum_Beduaram,	6213)
+ValuePair(Datum_Beijing_1954,	6214)
+ValuePair(Datum_Reseau_National_Belge_1950,	6215)
+ValuePair(Datum_Bermuda_1957,	6216)
+ValuePair(Datum_Bern_1898,	6217)
+ValuePair(Datum_Bogota,	6218)
+ValuePair(Datum_Bukit_Rimpah,	6219)
+ValuePair(Datum_Camacupa,	6220)
+ValuePair(Datum_Campo_Inchauspe,	6221)
+ValuePair(Datum_Cape,	6222)
+ValuePair(Datum_Carthage,	6223)
+ValuePair(Datum_Chua,	6224)
+ValuePair(Datum_Corrego_Alegre,	6225)
+ValuePair(Datum_Cote_d_Ivoire,	6226)
+ValuePair(Datum_Deir_ez_Zor,	6227)
+ValuePair(Datum_Douala,	6228)
+ValuePair(Datum_Egypt_1907,	6229)
+ValuePair(Datum_European_Datum_1950,	6230)
+ValuePair(Datum_European_Datum_1987,	6231)
+ValuePair(Datum_Fahud,	6232)
+ValuePair(Datum_Gandajika_1970,	6233)
+ValuePair(Datum_Garoua,	6234)
+ValuePair(Datum_Guyane_Francaise,	6235)
+ValuePair(Datum_Hu_Tzu_Shan,	6236)
+ValuePair(Datum_Hungarian_Datum_1972,	6237)
+ValuePair(Datum_Indonesian_Datum_1974,	6238)
+ValuePair(Datum_Indian_1954,	6239)
+ValuePair(Datum_Indian_1975,	6240)
+ValuePair(Datum_Jamaica_1875,	6241)
+ValuePair(Datum_Jamaica_1969,	6242)
+ValuePair(Datum_Kalianpur,	6243)
+ValuePair(Datum_Kandawala,	6244)
+ValuePair(Datum_Kertau,	6245)
+ValuePair(Datum_Kuwait_Oil_Company,	6246)
+ValuePair(Datum_La_Canoa,	6247)
+ValuePair(Datum_Provisional_S_American_Datum_1956,	6248)
+ValuePair(Datum_Lake,	6249)
+ValuePair(Datum_Leigon,	6250)
+ValuePair(Datum_Liberia_1964,	6251)
+ValuePair(Datum_Lome,	6252)
+ValuePair(Datum_Luzon_1911,	6253)
+ValuePair(Datum_Hito_XVIII_1963,	6254)
+ValuePair(Datum_Herat_North,	6255)
+ValuePair(Datum_Mahe_1971,	6256)
+ValuePair(Datum_Makassar,	6257)
+ValuePair(Datum_European_Reference_System_1989,	6258)
+ValuePair(Datum_Malongo_1987,	6259)
+ValuePair(Datum_Manoca,	6260)
+ValuePair(Datum_Merchich,	6261)
+ValuePair(Datum_Massawa,	6262)
+ValuePair(Datum_Minna,	6263)
+ValuePair(Datum_Mhast,	6264)
+ValuePair(Datum_Monte_Mario,	6265)
+ValuePair(Datum_M_poraloko,	6266)
+ValuePair(Datum_North_American_Datum_1927,	6267)
+ValuePair(Datum_NAD_Michigan,	6268)
+ValuePair(Datum_North_American_Datum_1983,	6269)
+ValuePair(Datum_Nahrwan_1967,	6270)
+ValuePair(Datum_Naparima_1972,	6271)
+ValuePair(Datum_New_Zealand_Geodetic_Datum_1949,	6272)
+ValuePair(Datum_NGO_1948,	6273)
+ValuePair(Datum_Datum_73,	6274)
+ValuePair(Datum_Nouvelle_Triangulation_Francaise,	6275)
+ValuePair(Datum_NSWC_9Z_2,	6276)
+ValuePair(Datum_OSGB_1936,	6277)
+ValuePair(Datum_OSGB_1970_SN,	6278)
+ValuePair(Datum_OS_SN_1980,	6279)
+ValuePair(Datum_Padang_1884,	6280)
+ValuePair(Datum_Palestine_1923,	6281)
+ValuePair(Datum_Pointe_Noire,	6282)
+ValuePair(Datum_Geocentric_Datum_of_Australia_1994,	6283)
+ValuePair(Datum_Pulkovo_1942,	6284)
+ValuePair(Datum_Qatar,	6285)
+ValuePair(Datum_Qatar_1948,	6286)
+ValuePair(Datum_Qornoq,	6287)
+ValuePair(Datum_Loma_Quintana,	6288)
+ValuePair(Datum_Amersfoort,	6289)
+ValuePair(Datum_RT38,	6290)
+ValuePair(Datum_South_American_Datum_1969,	6291)
+ValuePair(Datum_Sapper_Hill_1943,	6292)
+ValuePair(Datum_Schwarzeck,	6293)
+ValuePair(Datum_Segora,	6294)
+ValuePair(Datum_Serindung,	6295)
+ValuePair(Datum_Sudan,	6296)
+ValuePair(Datum_Tananarive_1925,	6297)
+ValuePair(Datum_Timbalai_1948,	6298)
+ValuePair(Datum_TM65,	6299)
+ValuePair(Datum_TM75,	6300)
+ValuePair(Datum_Tokyo,	6301)
+ValuePair(Datum_Trinidad_1903,	6302)
+ValuePair(Datum_Trucial_Coast_1948,	6303)
+ValuePair(Datum_Voirol_1875,	6304)
+ValuePair(Datum_Voirol_Unifie_1960,	6305)
+ValuePair(Datum_Bern_1938,	6306)
+ValuePair(Datum_Nord_Sahara_1959,	6307)
+ValuePair(Datum_Stockholm_1938,	6308)
+ValuePair(Datum_Yacare,	6309)
+ValuePair(Datum_Yoff,	6310)
+ValuePair(Datum_Zanderij,	6311)
+ValuePair(Datum_Militar_Geographische_Institut,	6312)
+ValuePair(Datum_Reseau_National_Belge_1972,	6313)
+ValuePair(Datum_Deutsche_Hauptdreiecksnetz,	6314)
+ValuePair(Datum_Conakry_1905,	6315)
+ValuePair(Datum_WGS72,	6322)
+ValuePair(Datum_WGS72_Transit_Broadcast_Ephemeris,	6324)
+ValuePair(Datum_WGS84,	6326)
+ValuePair(Datum_Ancienne_Triangulation_Francaise,	6901)
+ValuePair(Datum_Nord_de_Guerre,	6902)
+/* end of list */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_ellipse.inc
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_ellipse.inc	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_ellipse.inc	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,48 @@
+/*
+ *  GeoTIFF Rev. 0.2  Ellipsoids
+ */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_ellipse.inc
+#endif /* OLD Codes */
+
+ValuePair(Ellipse_Airy_1830,	7001)
+ValuePair(Ellipse_Airy_Modified_1849,	7002)
+ValuePair(Ellipse_Australian_National_Spheroid,	7003)
+ValuePair(Ellipse_Bessel_1841,	7004)
+ValuePair(Ellipse_Bessel_Modified,	7005)
+ValuePair(Ellipse_Bessel_Namibia,	7006)
+ValuePair(Ellipse_Clarke_1858,	7007)
+ValuePair(Ellipse_Clarke_1866,	7008)
+ValuePair(Ellipse_Clarke_1866_Michigan,	7009)
+ValuePair(Ellipse_Clarke_1880_Benoit,	7010)
+ValuePair(Ellipse_Clarke_1880_IGN,	7011)
+ValuePair(Ellipse_Clarke_1880_RGS,	7012)
+ValuePair(Ellipse_Clarke_1880_Arc,	7013)
+ValuePair(Ellipse_Clarke_1880_SGA_1922,	7014)
+ValuePair(Ellipse_Everest_1830_1937_Adjustment,	7015)
+ValuePair(Ellipse_Everest_1830_1967_Definition,	7016)
+ValuePair(Ellipse_Everest_1830_1975_Definition,	7017)
+ValuePair(Ellipse_Everest_1830_Modified,	7018)
+ValuePair(Ellipse_GRS_1980,	7019)
+ValuePair(Ellipse_Helmert_1906,	7020)
+ValuePair(Ellipse_Indonesian_National_Spheroid,	7021)
+ValuePair(Ellipse_International_1924,	7022)
+ValuePair(Ellipse_International_1967,	7023)
+ValuePair(Ellipse_Krassowsky_1940,	7024)
+ValuePair(Ellipse_NWL_9D,	7025)
+ValuePair(Ellipse_NWL_10D,	7026)
+ValuePair(Ellipse_Plessis_1817,	7027)
+ValuePair(Ellipse_Struve_1860,	7028)
+ValuePair(Ellipse_War_Office,	7029)
+ValuePair(Ellipse_WGS_84,	7030)
+ValuePair(Ellipse_GEM_10C,	7031)
+ValuePair(Ellipse_OSU86F,	7032)
+ValuePair(Ellipse_OSU91A,	7033)
+ValuePair(Ellipse_Clarke_1880,	7034)
+ValuePair(Ellipse_Sphere,	7035)
+/* end of list */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_gcs.inc
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_gcs.inc	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_gcs.inc	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,193 @@
+/*
+ *  EPSG/POSC GCS Codes -- GeoTIFF Rev. 0.2
+ */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_gcs.inc
+#endif /* OLD Codes */
+
+/* Unspecified GCS based on ellipsoid */
+ValuePair(GCSE_Airy1830,	4001)
+ValuePair(GCSE_AiryModified1849,	4002)
+ValuePair(GCSE_AustralianNationalSpheroid,	4003)
+ValuePair(GCSE_Bessel1841,	4004)
+ValuePair(GCSE_BesselModified,	4005)
+ValuePair(GCSE_BesselNamibia,	4006)
+ValuePair(GCSE_Clarke1858,	4007)
+ValuePair(GCSE_Clarke1866,	4008)
+ValuePair(GCSE_Clarke1866Michigan,	4009)
+ValuePair(GCSE_Clarke1880_Benoit,	4010)
+ValuePair(GCSE_Clarke1880_IGN,	4011)
+ValuePair(GCSE_Clarke1880_RGS,	4012)
+ValuePair(GCSE_Clarke1880_Arc,	4013)
+ValuePair(GCSE_Clarke1880_SGA1922,	4014)
+ValuePair(GCSE_Everest1830_1937Adjustment,	4015)
+ValuePair(GCSE_Everest1830_1967Definition,	4016)
+ValuePair(GCSE_Everest1830_1975Definition,	4017)
+ValuePair(GCSE_Everest1830Modified,	4018)
+ValuePair(GCSE_GRS1980,	4019)
+ValuePair(GCSE_Helmert1906,	4020)
+ValuePair(GCSE_IndonesianNationalSpheroid,	4021)
+ValuePair(GCSE_International1924,	4022)
+ValuePair(GCSE_International1967,	4023)
+ValuePair(GCSE_Krassowsky1940,	4024)
+ValuePair(GCSE_NWL9D,	4025)
+ValuePair(GCSE_NWL10D,	4026)
+ValuePair(GCSE_Plessis1817,	4027)
+ValuePair(GCSE_Struve1860,	4028)
+ValuePair(GCSE_WarOffice,	4029)
+ValuePair(GCSE_WGS84,	4030)
+ValuePair(GCSE_GEM10C,	4031)
+ValuePair(GCSE_OSU86F,	4032)
+ValuePair(GCSE_OSU91A,	4033)
+ValuePair(GCSE_Clarke1880,	4034)
+ValuePair(GCSE_Sphere,	4035)
+
+/* New GCS */
+ValuePair(GCS_Greek,4120)
+ValuePair(GCS_GGRS87,4121)
+ValuePair(GCS_KKJ,4123)
+ValuePair(GCS_RT90,4124)
+ValuePair(GCS_EST92,4133)
+ValuePair(GCS_Dealul_Piscului_1970,4317)
+ValuePair(GCS_Greek_Athens,4815)
+
+/* Standard GCS */
+ValuePair(GCS_Adindan,	4201)
+ValuePair(GCS_AGD66,	4202)
+ValuePair(GCS_AGD84,	4203)
+ValuePair(GCS_Ain_el_Abd,	4204)
+ValuePair(GCS_Afgooye,	4205)
+ValuePair(GCS_Agadez,	4206)
+ValuePair(GCS_Lisbon,	4207)
+ValuePair(GCS_Aratu,	4208)
+ValuePair(GCS_Arc_1950,	4209)
+ValuePair(GCS_Arc_1960,	4210)
+ValuePair(GCS_Batavia,	4211)
+ValuePair(GCS_Barbados,	4212)
+ValuePair(GCS_Beduaram,	4213)
+ValuePair(GCS_Beijing_1954,	4214)
+ValuePair(GCS_Belge_1950,	4215)
+ValuePair(GCS_Bermuda_1957,	4216)
+ValuePair(GCS_Bern_1898,	4217)
+ValuePair(GCS_Bogota,	4218)
+ValuePair(GCS_Bukit_Rimpah,	4219)
+ValuePair(GCS_Camacupa,	4220)
+ValuePair(GCS_Campo_Inchauspe,	4221)
+ValuePair(GCS_Cape,	4222)
+ValuePair(GCS_Carthage,	4223)
+ValuePair(GCS_Chua,	4224)
+ValuePair(GCS_Corrego_Alegre,	4225)
+ValuePair(GCS_Cote_d_Ivoire,	4226)
+ValuePair(GCS_Deir_ez_Zor,	4227)
+ValuePair(GCS_Douala,	4228)
+ValuePair(GCS_Egypt_1907,	4229)
+ValuePair(GCS_ED50,	4230)
+ValuePair(GCS_ED87,	4231)
+ValuePair(GCS_Fahud,	4232)
+ValuePair(GCS_Gandajika_1970,	4233)
+ValuePair(GCS_Garoua,	4234)
+ValuePair(GCS_Guyane_Francaise,	4235)
+ValuePair(GCS_Hu_Tzu_Shan,	4236)
+ValuePair(GCS_HD72,	4237)
+ValuePair(GCS_ID74,	4238)
+ValuePair(GCS_Indian_1954,	4239)
+ValuePair(GCS_Indian_1975,	4240)
+ValuePair(GCS_Jamaica_1875,	4241)
+ValuePair(GCS_JAD69,	4242)
+ValuePair(GCS_Kalianpur,	4243)
+ValuePair(GCS_Kandawala,	4244)
+ValuePair(GCS_Kertau,	4245)
+ValuePair(GCS_KOC,	4246)
+ValuePair(GCS_La_Canoa,	4247)
+ValuePair(GCS_PSAD56,	4248)
+ValuePair(GCS_Lake,	4249)
+ValuePair(GCS_Leigon,	4250)
+ValuePair(GCS_Liberia_1964,	4251)
+ValuePair(GCS_Lome,	4252)
+ValuePair(GCS_Luzon_1911,	4253)
+ValuePair(GCS_Hito_XVIII_1963,	4254)
+ValuePair(GCS_Herat_North,	4255)
+ValuePair(GCS_Mahe_1971,	4256)
+ValuePair(GCS_Makassar,	4257)
+ValuePair(GCS_EUREF89,	4258)
+ValuePair(GCS_Malongo_1987,	4259)
+ValuePair(GCS_Manoca,	4260)
+ValuePair(GCS_Merchich,	4261)
+ValuePair(GCS_Massawa,	4262)
+ValuePair(GCS_Minna,	4263)
+ValuePair(GCS_Mhast,	4264)
+ValuePair(GCS_Monte_Mario,	4265)
+ValuePair(GCS_M_poraloko,	4266)
+ValuePair(GCS_NAD27,	4267)
+ValuePair(GCS_NAD_Michigan,	4268)
+ValuePair(GCS_NAD83,	4269)
+ValuePair(GCS_Nahrwan_1967,	4270)
+ValuePair(GCS_Naparima_1972,	4271)
+ValuePair(GCS_GD49,	4272)
+ValuePair(GCS_NGO_1948,	4273)
+ValuePair(GCS_Datum_73,	4274)
+ValuePair(GCS_NTF,	4275)
+ValuePair(GCS_NSWC_9Z_2,	4276)
+ValuePair(GCS_OSGB_1936,	4277)
+ValuePair(GCS_OSGB70,	4278)
+ValuePair(GCS_OS_SN80,	4279)
+ValuePair(GCS_Padang,	4280)
+ValuePair(GCS_Palestine_1923,	4281)
+ValuePair(GCS_Pointe_Noire,	4282)
+ValuePair(GCS_GDA94,	4283)
+ValuePair(GCS_Pulkovo_1942,	4284)
+ValuePair(GCS_Qatar,	4285)
+ValuePair(GCS_Qatar_1948,	4286)
+ValuePair(GCS_Qornoq,	4287)
+ValuePair(GCS_Loma_Quintana,	4288)
+ValuePair(GCS_Amersfoort,	4289)
+ValuePair(GCS_RT38,	4290)
+ValuePair(GCS_SAD69,	4291)
+ValuePair(GCS_Sapper_Hill_1943,	4292)
+ValuePair(GCS_Schwarzeck,	4293)
+ValuePair(GCS_Segora,	4294)
+ValuePair(GCS_Serindung,	4295)
+ValuePair(GCS_Sudan,	4296)
+ValuePair(GCS_Tananarive,	4297)
+ValuePair(GCS_Timbalai_1948,	4298)
+ValuePair(GCS_TM65,	4299)
+ValuePair(GCS_TM75,	4300)
+ValuePair(GCS_Tokyo,	4301)
+ValuePair(GCS_Trinidad_1903,	4302)
+ValuePair(GCS_TC_1948,	4303)
+ValuePair(GCS_Voirol_1875,	4304)
+ValuePair(GCS_Voirol_Unifie,	4305)
+ValuePair(GCS_Bern_1938,	4306)
+ValuePair(GCS_Nord_Sahara_1959,	4307)
+ValuePair(GCS_Stockholm_1938,	4308)
+ValuePair(GCS_Yacare,	4309)
+ValuePair(GCS_Yoff,	4310)
+ValuePair(GCS_Zanderij,	4311)
+ValuePair(GCS_MGI,	4312)
+ValuePair(GCS_Belge_1972,	4313)
+ValuePair(GCS_DHDN,	4314)
+ValuePair(GCS_Conakry_1905,	4315)
+ValuePair(GCS_WGS_72,	4322)
+ValuePair(GCS_WGS_72BE,	4324)
+ValuePair(GCS_WGS_84,	4326)
+ValuePair(GCS_Bern_1898_Bern,	4801)
+ValuePair(GCS_Bogota_Bogota,	4802)
+ValuePair(GCS_Lisbon_Lisbon,	4803)
+ValuePair(GCS_Makassar_Jakarta,	4804)
+ValuePair(GCS_MGI_Ferro,	4805)
+ValuePair(GCS_Monte_Mario_Rome,	4806)
+ValuePair(GCS_NTF_Paris,	4807)
+ValuePair(GCS_Padang_Jakarta,	4808)
+ValuePair(GCS_Belge_1950_Brussels,	4809)
+ValuePair(GCS_Tananarive_Paris,	4810)
+ValuePair(GCS_Voirol_1875_Paris,	4811)
+ValuePair(GCS_Voirol_Unifie_Paris,	4812)
+ValuePair(GCS_Batavia_Jakarta,	4813)
+ValuePair(GCS_ATF_Paris,	4901)
+ValuePair(GCS_NDG_Paris,	4902)
+/* End of list */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_pcs.inc
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_pcs.inc	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_pcs.inc	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,1003 @@
+/*
+ *  EPSG PCS Codes - GeoTIFF Rev 0.2
+ */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_pcs.inc
+#endif /* OLD Codes */
+
+/* New PCS */
+ValuePair(PCS_GGRS87_Greek_Grid,2100)
+ValuePair(PCS_KKJ_Finland_zone_1,2391)
+ValuePair(PCS_KKJ_Finland_zone_2,2392)
+ValuePair(PCS_KKJ_Finland_zone_3,2393)
+ValuePair(PCS_KKJ_Finland_zone_4,2394)
+ValuePair(PCS_RT90_2_5_gon_W,2400)
+ValuePair(PCS_Lietuvos_Koordinoei_Sistema_1994,2600)
+ValuePair(PCS_Estonian_Coordinate_System_of_1992,3300)
+ValuePair(PCS_HD72_EOV,23700)
+ValuePair(PCS_Dealul_Piscului_1970_Stereo_70,31700)
+
+ValuePair(PCS_Adindan_UTM_zone_37N,	20137)
+ValuePair(PCS_Adindan_UTM_zone_38N,	20138)
+ValuePair(PCS_AGD66_AMG_zone_48,	20248)
+ValuePair(PCS_AGD66_AMG_zone_49,	20249)
+ValuePair(PCS_AGD66_AMG_zone_50,	20250)
+ValuePair(PCS_AGD66_AMG_zone_51,	20251)
+ValuePair(PCS_AGD66_AMG_zone_52,	20252)
+ValuePair(PCS_AGD66_AMG_zone_53,	20253)
+ValuePair(PCS_AGD66_AMG_zone_54,	20254)
+ValuePair(PCS_AGD66_AMG_zone_55,	20255)
+ValuePair(PCS_AGD66_AMG_zone_56,	20256)
+ValuePair(PCS_AGD66_AMG_zone_57,	20257)
+ValuePair(PCS_AGD66_AMG_zone_58,	20258)
+ValuePair(PCS_AGD84_AMG_zone_48,	20348)
+ValuePair(PCS_AGD84_AMG_zone_49,	20349)
+ValuePair(PCS_AGD84_AMG_zone_50,	20350)
+ValuePair(PCS_AGD84_AMG_zone_51,	20351)
+ValuePair(PCS_AGD84_AMG_zone_52,	20352)
+ValuePair(PCS_AGD84_AMG_zone_53,	20353)
+ValuePair(PCS_AGD84_AMG_zone_54,	20354)
+ValuePair(PCS_AGD84_AMG_zone_55,	20355)
+ValuePair(PCS_AGD84_AMG_zone_56,	20356)
+ValuePair(PCS_AGD84_AMG_zone_57,	20357)
+ValuePair(PCS_AGD84_AMG_zone_58,	20358)
+ValuePair(PCS_Ain_el_Abd_UTM_zone_37N,	20437)
+ValuePair(PCS_Ain_el_Abd_UTM_zone_38N,	20438)
+ValuePair(PCS_Ain_el_Abd_UTM_zone_39N,	20439)
+ValuePair(PCS_Ain_el_Abd_Bahrain_Grid,	20499)
+ValuePair(PCS_Afgooye_UTM_zone_38N,	20538)
+ValuePair(PCS_Afgooye_UTM_zone_39N,	20539)
+ValuePair(PCS_Lisbon_Portugese_Grid,	20700)
+ValuePair(PCS_Aratu_UTM_zone_22S,	20822)
+ValuePair(PCS_Aratu_UTM_zone_23S,	20823)
+ValuePair(PCS_Aratu_UTM_zone_24S,	20824)
+ValuePair(PCS_Arc_1950_Lo13,	20973)
+ValuePair(PCS_Arc_1950_Lo15,	20975)
+ValuePair(PCS_Arc_1950_Lo17,	20977)
+ValuePair(PCS_Arc_1950_Lo19,	20979)
+ValuePair(PCS_Arc_1950_Lo21,	20981)
+ValuePair(PCS_Arc_1950_Lo23,	20983)
+ValuePair(PCS_Arc_1950_Lo25,	20985)
+ValuePair(PCS_Arc_1950_Lo27,	20987)
+ValuePair(PCS_Arc_1950_Lo29,	20989)
+ValuePair(PCS_Arc_1950_Lo31,	20991)
+ValuePair(PCS_Arc_1950_Lo33,	20993)
+ValuePair(PCS_Arc_1950_Lo35,	20995)
+ValuePair(PCS_Batavia_NEIEZ,	21100)
+ValuePair(PCS_Batavia_UTM_zone_48S,	21148)
+ValuePair(PCS_Batavia_UTM_zone_49S,	21149)
+ValuePair(PCS_Batavia_UTM_zone_50S,	21150)
+ValuePair(PCS_Beijing_Gauss_zone_13,	21413)
+ValuePair(PCS_Beijing_Gauss_zone_14,	21414)
+ValuePair(PCS_Beijing_Gauss_zone_15,	21415)
+ValuePair(PCS_Beijing_Gauss_zone_16,	21416)
+ValuePair(PCS_Beijing_Gauss_zone_17,	21417)
+ValuePair(PCS_Beijing_Gauss_zone_18,	21418)
+ValuePair(PCS_Beijing_Gauss_zone_19,	21419)
+ValuePair(PCS_Beijing_Gauss_zone_20,	21420)
+ValuePair(PCS_Beijing_Gauss_zone_21,	21421)
+ValuePair(PCS_Beijing_Gauss_zone_22,	21422)
+ValuePair(PCS_Beijing_Gauss_zone_23,	21423)
+ValuePair(PCS_Beijing_Gauss_13N,	21473)
+ValuePair(PCS_Beijing_Gauss_14N,	21474)
+ValuePair(PCS_Beijing_Gauss_15N,	21475)
+ValuePair(PCS_Beijing_Gauss_16N,	21476)
+ValuePair(PCS_Beijing_Gauss_17N,	21477)
+ValuePair(PCS_Beijing_Gauss_18N,	21478)
+ValuePair(PCS_Beijing_Gauss_19N,	21479)
+ValuePair(PCS_Beijing_Gauss_20N,	21480)
+ValuePair(PCS_Beijing_Gauss_21N,	21481)
+ValuePair(PCS_Beijing_Gauss_22N,	21482)
+ValuePair(PCS_Beijing_Gauss_23N,	21483)
+ValuePair(PCS_Belge_Lambert_50,	21500)
+ValuePair(PCS_Bern_1898_Swiss_Old,	21790)
+ValuePair(PCS_Bogota_UTM_zone_17N,	21817)
+ValuePair(PCS_Bogota_UTM_zone_18N,	21818)
+ValuePair(PCS_Bogota_Colombia_3W,	21891)
+ValuePair(PCS_Bogota_Colombia_Bogota,	21892)
+ValuePair(PCS_Bogota_Colombia_3E,	21893)
+ValuePair(PCS_Bogota_Colombia_6E,	21894)
+ValuePair(PCS_Camacupa_UTM_32S,	22032)
+ValuePair(PCS_Camacupa_UTM_33S,	22033)
+ValuePair(PCS_C_Inchauspe_Argentina_1,	22191)
+ValuePair(PCS_C_Inchauspe_Argentina_2,	22192)
+ValuePair(PCS_C_Inchauspe_Argentina_3,	22193)
+ValuePair(PCS_C_Inchauspe_Argentina_4,	22194)
+ValuePair(PCS_C_Inchauspe_Argentina_5,	22195)
+ValuePair(PCS_C_Inchauspe_Argentina_6,	22196)
+ValuePair(PCS_C_Inchauspe_Argentina_7,	22197)
+ValuePair(PCS_Carthage_UTM_zone_32N,	22332)
+ValuePair(PCS_Carthage_Nord_Tunisie,	22391)
+ValuePair(PCS_Carthage_Sud_Tunisie,	22392)
+ValuePair(PCS_Corrego_Alegre_UTM_23S,	22523)
+ValuePair(PCS_Corrego_Alegre_UTM_24S,	22524)
+ValuePair(PCS_Douala_UTM_zone_32N,	22832)
+ValuePair(PCS_Egypt_1907_Red_Belt,	22992)
+ValuePair(PCS_Egypt_1907_Purple_Belt,	22993)
+ValuePair(PCS_Egypt_1907_Ext_Purple,	22994)
+ValuePair(PCS_ED50_UTM_zone_28N,	23028)
+ValuePair(PCS_ED50_UTM_zone_29N,	23029)
+ValuePair(PCS_ED50_UTM_zone_30N,	23030)
+ValuePair(PCS_ED50_UTM_zone_31N,	23031)
+ValuePair(PCS_ED50_UTM_zone_32N,	23032)
+ValuePair(PCS_ED50_UTM_zone_33N,	23033)
+ValuePair(PCS_ED50_UTM_zone_34N,	23034)
+ValuePair(PCS_ED50_UTM_zone_35N,	23035)
+ValuePair(PCS_ED50_UTM_zone_36N,	23036)
+ValuePair(PCS_ED50_UTM_zone_37N,	23037)
+ValuePair(PCS_ED50_UTM_zone_38N,	23038)
+ValuePair(PCS_Fahud_UTM_zone_39N,	23239)
+ValuePair(PCS_Fahud_UTM_zone_40N,	23240)
+ValuePair(PCS_Garoua_UTM_zone_33N,	23433)
+ValuePair(PCS_ID74_UTM_zone_46N,	23846)
+ValuePair(PCS_ID74_UTM_zone_47N,	23847)
+ValuePair(PCS_ID74_UTM_zone_48N,	23848)
+ValuePair(PCS_ID74_UTM_zone_49N,	23849)
+ValuePair(PCS_ID74_UTM_zone_50N,	23850)
+ValuePair(PCS_ID74_UTM_zone_51N,	23851)
+ValuePair(PCS_ID74_UTM_zone_52N,	23852)
+ValuePair(PCS_ID74_UTM_zone_53N,	23853)
+ValuePair(PCS_ID74_UTM_zone_46S,	23886)
+ValuePair(PCS_ID74_UTM_zone_47S,	23887)
+ValuePair(PCS_ID74_UTM_zone_48S,	23888)
+ValuePair(PCS_ID74_UTM_zone_49S,	23889)
+ValuePair(PCS_ID74_UTM_zone_50S,	23890)
+ValuePair(PCS_ID74_UTM_zone_51S,	23891)
+ValuePair(PCS_ID74_UTM_zone_52S,	23892)
+ValuePair(PCS_ID74_UTM_zone_53S,	23893)
+ValuePair(PCS_ID74_UTM_zone_54S,	23894)
+ValuePair(PCS_Indian_1954_UTM_47N,	23947)
+ValuePair(PCS_Indian_1954_UTM_48N,	23948)
+ValuePair(PCS_Indian_1975_UTM_47N,	24047)
+ValuePair(PCS_Indian_1975_UTM_48N,	24048)
+ValuePair(PCS_Jamaica_1875_Old_Grid,	24100)
+ValuePair(PCS_JAD69_Jamaica_Grid,	24200)
+ValuePair(PCS_Kalianpur_India_0,	24370)
+ValuePair(PCS_Kalianpur_India_I,	24371)
+ValuePair(PCS_Kalianpur_India_IIa,	24372)
+ValuePair(PCS_Kalianpur_India_IIIa,	24373)
+ValuePair(PCS_Kalianpur_India_IVa,	24374)
+ValuePair(PCS_Kalianpur_India_IIb,	24382)
+ValuePair(PCS_Kalianpur_India_IIIb,	24383)
+ValuePair(PCS_Kalianpur_India_IVb,	24384)
+ValuePair(PCS_Kertau_Singapore_Grid,	24500)
+ValuePair(PCS_Kertau_UTM_zone_47N,	24547)
+ValuePair(PCS_Kertau_UTM_zone_48N,	24548)
+ValuePair(PCS_La_Canoa_UTM_zone_20N,	24720)
+ValuePair(PCS_La_Canoa_UTM_zone_21N,	24721)
+ValuePair(PCS_PSAD56_UTM_zone_18N,	24818)
+ValuePair(PCS_PSAD56_UTM_zone_19N,	24819)
+ValuePair(PCS_PSAD56_UTM_zone_20N,	24820)
+ValuePair(PCS_PSAD56_UTM_zone_21N,	24821)
+ValuePair(PCS_PSAD56_UTM_zone_17S,	24877)
+ValuePair(PCS_PSAD56_UTM_zone_18S,	24878)
+ValuePair(PCS_PSAD56_UTM_zone_19S,	24879)
+ValuePair(PCS_PSAD56_UTM_zone_20S,	24880)
+ValuePair(PCS_PSAD56_Peru_west_zone,	24891)
+ValuePair(PCS_PSAD56_Peru_central,	24892)
+ValuePair(PCS_PSAD56_Peru_east_zone,	24893)
+ValuePair(PCS_Leigon_Ghana_Grid,	25000)
+ValuePair(PCS_Lome_UTM_zone_31N,	25231)
+ValuePair(PCS_Luzon_Philippines_I,	25391)
+ValuePair(PCS_Luzon_Philippines_II,	25392)
+ValuePair(PCS_Luzon_Philippines_III,	25393)
+ValuePair(PCS_Luzon_Philippines_IV,	25394)
+ValuePair(PCS_Luzon_Philippines_V,	25395)
+ValuePair(PCS_Makassar_NEIEZ,	25700)
+ValuePair(PCS_Malongo_1987_UTM_32S,	25932)
+ValuePair(PCS_Merchich_Nord_Maroc,	26191)
+ValuePair(PCS_Merchich_Sud_Maroc,	26192)
+ValuePair(PCS_Merchich_Sahara,	26193)
+ValuePair(PCS_Massawa_UTM_zone_37N,	26237)
+ValuePair(PCS_Minna_UTM_zone_31N,	26331)
+ValuePair(PCS_Minna_UTM_zone_32N,	26332)
+ValuePair(PCS_Minna_Nigeria_West,	26391)
+ValuePair(PCS_Minna_Nigeria_Mid_Belt,	26392)
+ValuePair(PCS_Minna_Nigeria_East,	26393)
+ValuePair(PCS_Mhast_UTM_zone_32S,	26432)
+ValuePair(PCS_Monte_Mario_Italy_1,	26591)
+ValuePair(PCS_Monte_Mario_Italy_2,	26592)
+ValuePair(PCS_M_poraloko_UTM_32N,	26632)
+ValuePair(PCS_M_poraloko_UTM_32S,	26692)
+ValuePair(PCS_NAD27_UTM_zone_3N,	26703)
+ValuePair(PCS_NAD27_UTM_zone_4N,	26704)
+ValuePair(PCS_NAD27_UTM_zone_5N,	26705)
+ValuePair(PCS_NAD27_UTM_zone_6N,	26706)
+ValuePair(PCS_NAD27_UTM_zone_7N,	26707)
+ValuePair(PCS_NAD27_UTM_zone_8N,	26708)
+ValuePair(PCS_NAD27_UTM_zone_9N,	26709)
+ValuePair(PCS_NAD27_UTM_zone_10N,	26710)
+ValuePair(PCS_NAD27_UTM_zone_11N,	26711)
+ValuePair(PCS_NAD27_UTM_zone_12N,	26712)
+ValuePair(PCS_NAD27_UTM_zone_13N,	26713)
+ValuePair(PCS_NAD27_UTM_zone_14N,	26714)
+ValuePair(PCS_NAD27_UTM_zone_15N,	26715)
+ValuePair(PCS_NAD27_UTM_zone_16N,	26716)
+ValuePair(PCS_NAD27_UTM_zone_17N,	26717)
+ValuePair(PCS_NAD27_UTM_zone_18N,	26718)
+ValuePair(PCS_NAD27_UTM_zone_19N,	26719)
+ValuePair(PCS_NAD27_UTM_zone_20N,	26720)
+ValuePair(PCS_NAD27_UTM_zone_21N,	26721)
+ValuePair(PCS_NAD27_UTM_zone_22N,	26722)
+ValuePair(PCS_NAD27_Alabama_East,	26729)
+ValuePair(PCS_NAD27_Alabama_West,	26730)
+ValuePair(PCS_NAD27_Alaska_zone_1,	26731)
+ValuePair(PCS_NAD27_Alaska_zone_2,	26732)
+ValuePair(PCS_NAD27_Alaska_zone_3,	26733)
+ValuePair(PCS_NAD27_Alaska_zone_4,	26734)
+ValuePair(PCS_NAD27_Alaska_zone_5,	26735)
+ValuePair(PCS_NAD27_Alaska_zone_6,	26736)
+ValuePair(PCS_NAD27_Alaska_zone_7,	26737)
+ValuePair(PCS_NAD27_Alaska_zone_8,	26738)
+ValuePair(PCS_NAD27_Alaska_zone_9,	26739)
+ValuePair(PCS_NAD27_Alaska_zone_10,	26740)
+ValuePair(PCS_NAD27_California_I,	26741)
+ValuePair(PCS_NAD27_California_II,	26742)
+ValuePair(PCS_NAD27_California_III,	26743)
+ValuePair(PCS_NAD27_California_IV,	26744)
+ValuePair(PCS_NAD27_California_V,	26745)
+ValuePair(PCS_NAD27_California_VI,	26746)
+ValuePair(PCS_NAD27_California_VII,	26747)
+ValuePair(PCS_NAD27_Arizona_East,	26748)
+ValuePair(PCS_NAD27_Arizona_Central,	26749)
+ValuePair(PCS_NAD27_Arizona_West,	26750)
+ValuePair(PCS_NAD27_Arkansas_North,	26751)
+ValuePair(PCS_NAD27_Arkansas_South,	26752)
+ValuePair(PCS_NAD27_Colorado_North,	26753)
+ValuePair(PCS_NAD27_Colorado_Central,	26754)
+ValuePair(PCS_NAD27_Colorado_South,	26755)
+ValuePair(PCS_NAD27_Connecticut,	26756)
+ValuePair(PCS_NAD27_Delaware,	26757)
+ValuePair(PCS_NAD27_Florida_East,	26758)
+ValuePair(PCS_NAD27_Florida_West,	26759)
+ValuePair(PCS_NAD27_Florida_North,	26760)
+ValuePair(PCS_NAD27_Hawaii_zone_1,	26761)
+ValuePair(PCS_NAD27_Hawaii_zone_2,	26762)
+ValuePair(PCS_NAD27_Hawaii_zone_3,	26763)
+ValuePair(PCS_NAD27_Hawaii_zone_4,	26764)
+ValuePair(PCS_NAD27_Hawaii_zone_5,	26765)
+ValuePair(PCS_NAD27_Georgia_East,	26766)
+ValuePair(PCS_NAD27_Georgia_West,	26767)
+ValuePair(PCS_NAD27_Idaho_East,	26768)
+ValuePair(PCS_NAD27_Idaho_Central,	26769)
+ValuePair(PCS_NAD27_Idaho_West,	26770)
+ValuePair(PCS_NAD27_Illinois_East,	26771)
+ValuePair(PCS_NAD27_Illinois_West,	26772)
+ValuePair(PCS_NAD27_Indiana_East,	26773)
+ValuePair(PCS_NAD27_BLM_14N_feet,	26774)
+ValuePair(PCS_NAD27_Indiana_West,	26774)
+ValuePair(PCS_NAD27_BLM_15N_feet,	26775)
+ValuePair(PCS_NAD27_Iowa_North,	26775)
+ValuePair(PCS_NAD27_BLM_16N_feet,	26776)
+ValuePair(PCS_NAD27_Iowa_South,	26776)
+ValuePair(PCS_NAD27_BLM_17N_feet,	26777)
+ValuePair(PCS_NAD27_Kansas_North,	26777)
+ValuePair(PCS_NAD27_Kansas_South,	26778)
+ValuePair(PCS_NAD27_Kentucky_North,	26779)
+ValuePair(PCS_NAD27_Kentucky_South,	26780)
+ValuePair(PCS_NAD27_Louisiana_North,	26781)
+ValuePair(PCS_NAD27_Louisiana_South,	26782)
+ValuePair(PCS_NAD27_Maine_East,	26783)
+ValuePair(PCS_NAD27_Maine_West,	26784)
+ValuePair(PCS_NAD27_Maryland,	26785)
+ValuePair(PCS_NAD27_Massachusetts,	26786)
+ValuePair(PCS_NAD27_Massachusetts_Is,	26787)
+ValuePair(PCS_NAD27_Michigan_North,	26788)
+ValuePair(PCS_NAD27_Michigan_Central,	26789)
+ValuePair(PCS_NAD27_Michigan_South,	26790)
+ValuePair(PCS_NAD27_Minnesota_North,	26791)
+ValuePair(PCS_NAD27_Minnesota_Cent,	26792)
+ValuePair(PCS_NAD27_Minnesota_South,	26793)
+ValuePair(PCS_NAD27_Mississippi_East,	26794)
+ValuePair(PCS_NAD27_Mississippi_West,	26795)
+ValuePair(PCS_NAD27_Missouri_East,	26796)
+ValuePair(PCS_NAD27_Missouri_Central,	26797)
+ValuePair(PCS_NAD27_Missouri_West,	26798)
+ValuePair(PCS_NAD_Michigan_Michigan_East,	26801)
+ValuePair(PCS_NAD_Michigan_Michigan_Old_Central,	26802)
+ValuePair(PCS_NAD_Michigan_Michigan_West,	26803)
+ValuePair(PCS_NAD83_UTM_zone_3N,	26903)
+ValuePair(PCS_NAD83_UTM_zone_4N,	26904)
+ValuePair(PCS_NAD83_UTM_zone_5N,	26905)
+ValuePair(PCS_NAD83_UTM_zone_6N,	26906)
+ValuePair(PCS_NAD83_UTM_zone_7N,	26907)
+ValuePair(PCS_NAD83_UTM_zone_8N,	26908)
+ValuePair(PCS_NAD83_UTM_zone_9N,	26909)
+ValuePair(PCS_NAD83_UTM_zone_10N,	26910)
+ValuePair(PCS_NAD83_UTM_zone_11N,	26911)
+ValuePair(PCS_NAD83_UTM_zone_12N,	26912)
+ValuePair(PCS_NAD83_UTM_zone_13N,	26913)
+ValuePair(PCS_NAD83_UTM_zone_14N,	26914)
+ValuePair(PCS_NAD83_UTM_zone_15N,	26915)
+ValuePair(PCS_NAD83_UTM_zone_16N,	26916)
+ValuePair(PCS_NAD83_UTM_zone_17N,	26917)
+ValuePair(PCS_NAD83_UTM_zone_18N,	26918)
+ValuePair(PCS_NAD83_UTM_zone_19N,	26919)
+ValuePair(PCS_NAD83_UTM_zone_20N,	26920)
+ValuePair(PCS_NAD83_UTM_zone_21N,	26921)
+ValuePair(PCS_NAD83_UTM_zone_22N,	26922)
+ValuePair(PCS_NAD83_UTM_zone_23N,	26923)
+ValuePair(PCS_NAD83_Alabama_East,	26929)
+ValuePair(PCS_NAD83_Alabama_West,	26930)
+ValuePair(PCS_NAD83_Alaska_zone_1,	26931)
+ValuePair(PCS_NAD83_Alaska_zone_2,	26932)
+ValuePair(PCS_NAD83_Alaska_zone_3,	26933)
+ValuePair(PCS_NAD83_Alaska_zone_4,	26934)
+ValuePair(PCS_NAD83_Alaska_zone_5,	26935)
+ValuePair(PCS_NAD83_Alaska_zone_6,	26936)
+ValuePair(PCS_NAD83_Alaska_zone_7,	26937)
+ValuePair(PCS_NAD83_Alaska_zone_8,	26938)
+ValuePair(PCS_NAD83_Alaska_zone_9,	26939)
+ValuePair(PCS_NAD83_Alaska_zone_10,	26940)
+ValuePair(PCS_NAD83_California_1,	26941)
+ValuePair(PCS_NAD83_California_2,	26942)
+ValuePair(PCS_NAD83_California_3,	26943)
+ValuePair(PCS_NAD83_California_4,	26944)
+ValuePair(PCS_NAD83_California_5,	26945)
+ValuePair(PCS_NAD83_California_6,	26946)
+ValuePair(PCS_NAD83_Arizona_East,	26948)
+ValuePair(PCS_NAD83_Arizona_Central,	26949)
+ValuePair(PCS_NAD83_Arizona_West,	26950)
+ValuePair(PCS_NAD83_Arkansas_North,	26951)
+ValuePair(PCS_NAD83_Arkansas_South,	26952)
+ValuePair(PCS_NAD83_Colorado_North,	26953)
+ValuePair(PCS_NAD83_Colorado_Central,	26954)
+ValuePair(PCS_NAD83_Colorado_South,	26955)
+ValuePair(PCS_NAD83_Connecticut,	26956)
+ValuePair(PCS_NAD83_Delaware,	26957)
+ValuePair(PCS_NAD83_Florida_East,	26958)
+ValuePair(PCS_NAD83_Florida_West,	26959)
+ValuePair(PCS_NAD83_Florida_North,	26960)
+ValuePair(PCS_NAD83_Hawaii_zone_1,	26961)
+ValuePair(PCS_NAD83_Hawaii_zone_2,	26962)
+ValuePair(PCS_NAD83_Hawaii_zone_3,	26963)
+ValuePair(PCS_NAD83_Hawaii_zone_4,	26964)
+ValuePair(PCS_NAD83_Hawaii_zone_5,	26965)
+ValuePair(PCS_NAD83_Georgia_East,	26966)
+ValuePair(PCS_NAD83_Georgia_West,	26967)
+ValuePair(PCS_NAD83_Idaho_East,	26968)
+ValuePair(PCS_NAD83_Idaho_Central,	26969)
+ValuePair(PCS_NAD83_Idaho_West,	26970)
+ValuePair(PCS_NAD83_Illinois_East,	26971)
+ValuePair(PCS_NAD83_Illinois_West,	26972)
+ValuePair(PCS_NAD83_Indiana_East,	26973)
+ValuePair(PCS_NAD83_Indiana_West,	26974)
+ValuePair(PCS_NAD83_Iowa_North,	26975)
+ValuePair(PCS_NAD83_Iowa_South,	26976)
+ValuePair(PCS_NAD83_Kansas_North,	26977)
+ValuePair(PCS_NAD83_Kansas_South,	26978)
+ValuePair(PCS_NAD83_Kentucky_North,	2205)
+ValuePair(PCS_NAD83_Kentucky_South,	26980)
+ValuePair(PCS_NAD83_Louisiana_North,	26981)
+ValuePair(PCS_NAD83_Louisiana_South,	26982)
+ValuePair(PCS_NAD83_Maine_East,	26983)
+ValuePair(PCS_NAD83_Maine_West,	26984)
+ValuePair(PCS_NAD83_Maryland,	26985)
+ValuePair(PCS_NAD83_Massachusetts,	26986)
+ValuePair(PCS_NAD83_Massachusetts_Is,	26987)
+ValuePair(PCS_NAD83_Michigan_North,	26988)
+ValuePair(PCS_NAD83_Michigan_Central,	26989)
+ValuePair(PCS_NAD83_Michigan_South,	26990)
+ValuePair(PCS_NAD83_Minnesota_North,	26991)
+ValuePair(PCS_NAD83_Minnesota_Cent,	26992)
+ValuePair(PCS_NAD83_Minnesota_South,	26993)
+ValuePair(PCS_NAD83_Mississippi_East,	26994)
+ValuePair(PCS_NAD83_Mississippi_West,	26995)
+ValuePair(PCS_NAD83_Missouri_East,	26996)
+ValuePair(PCS_NAD83_Missouri_Central,	26997)
+ValuePair(PCS_NAD83_Missouri_West,	26998)
+ValuePair(PCS_Nahrwan_1967_UTM_38N,	27038)
+ValuePair(PCS_Nahrwan_1967_UTM_39N,	27039)
+ValuePair(PCS_Nahrwan_1967_UTM_40N,	27040)
+ValuePair(PCS_Naparima_UTM_20N,	27120)
+ValuePair(PCS_GD49_NZ_Map_Grid,	27200)
+ValuePair(PCS_GD49_North_Island_Grid,	27291)
+ValuePair(PCS_GD49_South_Island_Grid,	27292)
+ValuePair(PCS_Datum_73_UTM_zone_29N,	27429)
+ValuePair(PCS_ATF_Nord_de_Guerre,	27500)
+ValuePair(PCS_NTF_France_I,	27581)
+ValuePair(PCS_NTF_France_II,	27582)
+ValuePair(PCS_NTF_France_III,	27583)
+ValuePair(PCS_NTF_Nord_France,	27591)
+ValuePair(PCS_NTF_Centre_France,	27592)
+ValuePair(PCS_NTF_Sud_France,	27593)
+ValuePair(PCS_British_National_Grid,	27700)
+ValuePair(PCS_Point_Noire_UTM_32S,	28232)
+ValuePair(PCS_GDA94_MGA_zone_48,	28348)
+ValuePair(PCS_GDA94_MGA_zone_49,	28349)
+ValuePair(PCS_GDA94_MGA_zone_50,	28350)
+ValuePair(PCS_GDA94_MGA_zone_51,	28351)
+ValuePair(PCS_GDA94_MGA_zone_52,	28352)
+ValuePair(PCS_GDA94_MGA_zone_53,	28353)
+ValuePair(PCS_GDA94_MGA_zone_54,	28354)
+ValuePair(PCS_GDA94_MGA_zone_55,	28355)
+ValuePair(PCS_GDA94_MGA_zone_56,	28356)
+ValuePair(PCS_GDA94_MGA_zone_57,	28357)
+ValuePair(PCS_GDA94_MGA_zone_58,	28358)
+ValuePair(PCS_Pulkovo_Gauss_zone_4,	28404)
+ValuePair(PCS_Pulkovo_Gauss_zone_5,	28405)
+ValuePair(PCS_Pulkovo_Gauss_zone_6,	28406)
+ValuePair(PCS_Pulkovo_Gauss_zone_7,	28407)
+ValuePair(PCS_Pulkovo_Gauss_zone_8,	28408)
+ValuePair(PCS_Pulkovo_Gauss_zone_9,	28409)
+ValuePair(PCS_Pulkovo_Gauss_zone_10,	28410)
+ValuePair(PCS_Pulkovo_Gauss_zone_11,	28411)
+ValuePair(PCS_Pulkovo_Gauss_zone_12,	28412)
+ValuePair(PCS_Pulkovo_Gauss_zone_13,	28413)
+ValuePair(PCS_Pulkovo_Gauss_zone_14,	28414)
+ValuePair(PCS_Pulkovo_Gauss_zone_15,	28415)
+ValuePair(PCS_Pulkovo_Gauss_zone_16,	28416)
+ValuePair(PCS_Pulkovo_Gauss_zone_17,	28417)
+ValuePair(PCS_Pulkovo_Gauss_zone_18,	28418)
+ValuePair(PCS_Pulkovo_Gauss_zone_19,	28419)
+ValuePair(PCS_Pulkovo_Gauss_zone_20,	28420)
+ValuePair(PCS_Pulkovo_Gauss_zone_21,	28421)
+ValuePair(PCS_Pulkovo_Gauss_zone_22,	28422)
+ValuePair(PCS_Pulkovo_Gauss_zone_23,	28423)
+ValuePair(PCS_Pulkovo_Gauss_zone_24,	28424)
+ValuePair(PCS_Pulkovo_Gauss_zone_25,	28425)
+ValuePair(PCS_Pulkovo_Gauss_zone_26,	28426)
+ValuePair(PCS_Pulkovo_Gauss_zone_27,	28427)
+ValuePair(PCS_Pulkovo_Gauss_zone_28,	28428)
+ValuePair(PCS_Pulkovo_Gauss_zone_29,	28429)
+ValuePair(PCS_Pulkovo_Gauss_zone_30,	28430)
+ValuePair(PCS_Pulkovo_Gauss_zone_31,	28431)
+ValuePair(PCS_Pulkovo_Gauss_zone_32,	28432)
+ValuePair(PCS_Pulkovo_Gauss_4N,	28464)
+ValuePair(PCS_Pulkovo_Gauss_5N,	28465)
+ValuePair(PCS_Pulkovo_Gauss_6N,	28466)
+ValuePair(PCS_Pulkovo_Gauss_7N,	28467)
+ValuePair(PCS_Pulkovo_Gauss_8N,	28468)
+ValuePair(PCS_Pulkovo_Gauss_9N,	28469)
+ValuePair(PCS_Pulkovo_Gauss_10N,	28470)
+ValuePair(PCS_Pulkovo_Gauss_11N,	28471)
+ValuePair(PCS_Pulkovo_Gauss_12N,	28472)
+ValuePair(PCS_Pulkovo_Gauss_13N,	28473)
+ValuePair(PCS_Pulkovo_Gauss_14N,	28474)
+ValuePair(PCS_Pulkovo_Gauss_15N,	28475)
+ValuePair(PCS_Pulkovo_Gauss_16N,	28476)
+ValuePair(PCS_Pulkovo_Gauss_17N,	28477)
+ValuePair(PCS_Pulkovo_Gauss_18N,	28478)
+ValuePair(PCS_Pulkovo_Gauss_19N,	28479)
+ValuePair(PCS_Pulkovo_Gauss_20N,	28480)
+ValuePair(PCS_Pulkovo_Gauss_21N,	28481)
+ValuePair(PCS_Pulkovo_Gauss_22N,	28482)
+ValuePair(PCS_Pulkovo_Gauss_23N,	28483)
+ValuePair(PCS_Pulkovo_Gauss_24N,	28484)
+ValuePair(PCS_Pulkovo_Gauss_25N,	28485)
+ValuePair(PCS_Pulkovo_Gauss_26N,	28486)
+ValuePair(PCS_Pulkovo_Gauss_27N,	28487)
+ValuePair(PCS_Pulkovo_Gauss_28N,	28488)
+ValuePair(PCS_Pulkovo_Gauss_29N,	28489)
+ValuePair(PCS_Pulkovo_Gauss_30N,	28490)
+ValuePair(PCS_Pulkovo_Gauss_31N,	28491)
+ValuePair(PCS_Pulkovo_Gauss_32N,	28492)
+ValuePair(PCS_Qatar_National_Grid,	28600)
+ValuePair(PCS_RD_Netherlands_Old,	28991)
+ValuePair(PCS_RD_Netherlands_New,	28992)
+ValuePair(PCS_SAD69_UTM_zone_18N,	29118)
+ValuePair(PCS_SAD69_UTM_zone_19N,	29119)
+ValuePair(PCS_SAD69_UTM_zone_20N,	29120)
+ValuePair(PCS_SAD69_UTM_zone_21N,	29121)
+ValuePair(PCS_SAD69_UTM_zone_22N,	29122)
+ValuePair(PCS_SAD69_UTM_zone_17S,	29177)
+ValuePair(PCS_SAD69_UTM_zone_18S,	29178)
+ValuePair(PCS_SAD69_UTM_zone_19S,	29179)
+ValuePair(PCS_SAD69_UTM_zone_20S,	29180)
+ValuePair(PCS_SAD69_UTM_zone_21S,	29181)
+ValuePair(PCS_SAD69_UTM_zone_22S,	29182)
+ValuePair(PCS_SAD69_UTM_zone_23S,	29183)
+ValuePair(PCS_SAD69_UTM_zone_24S,	29184)
+ValuePair(PCS_SAD69_UTM_zone_25S,	29185)
+ValuePair(PCS_Sapper_Hill_UTM_20S,	29220)
+ValuePair(PCS_Sapper_Hill_UTM_21S,	29221)
+ValuePair(PCS_Schwarzeck_UTM_33S,	29333)
+ValuePair(PCS_Sudan_UTM_zone_35N,	29635)
+ValuePair(PCS_Sudan_UTM_zone_36N,	29636)
+ValuePair(PCS_Tananarive_Laborde,	29700)
+ValuePair(PCS_Tananarive_UTM_38S,	29738)
+ValuePair(PCS_Tananarive_UTM_39S,	29739)
+ValuePair(PCS_Timbalai_1948_Borneo,	29800)
+ValuePair(PCS_Timbalai_1948_UTM_49N,	29849)
+ValuePair(PCS_Timbalai_1948_UTM_50N,	29850)
+ValuePair(PCS_TM65_Irish_Nat_Grid,	29900)
+ValuePair(PCS_Trinidad_1903_Trinidad,	30200)
+ValuePair(PCS_TC_1948_UTM_zone_39N,	30339)
+ValuePair(PCS_TC_1948_UTM_zone_40N,	30340)
+ValuePair(PCS_Voirol_N_Algerie_ancien,	30491)
+ValuePair(PCS_Voirol_S_Algerie_ancien,	30492)
+ValuePair(PCS_Voirol_Unifie_N_Algerie,	30591)
+ValuePair(PCS_Voirol_Unifie_S_Algerie,	30592)
+ValuePair(PCS_Bern_1938_Swiss_New,	30600)
+ValuePair(PCS_Nord_Sahara_UTM_29N,	30729)
+ValuePair(PCS_Nord_Sahara_UTM_30N,	30730)
+ValuePair(PCS_Nord_Sahara_UTM_31N,	30731)
+ValuePair(PCS_Nord_Sahara_UTM_32N,	30732)
+ValuePair(PCS_Yoff_UTM_zone_28N,	31028)
+ValuePair(PCS_Zanderij_UTM_zone_21N,	31121)
+ValuePair(PCS_MGI_Austria_West,	31291)
+ValuePair(PCS_MGI_Austria_Central,	31292)
+ValuePair(PCS_MGI_Austria_East,	31293)
+ValuePair(PCS_Belge_Lambert_72,	31300)
+ValuePair(PCS_DHDN_Germany_zone_1,	31491)
+ValuePair(PCS_DHDN_Germany_zone_2,	31492)
+ValuePair(PCS_DHDN_Germany_zone_3,	31493)
+ValuePair(PCS_DHDN_Germany_zone_4,	31494)
+ValuePair(PCS_DHDN_Germany_zone_5,	31495)
+ValuePair(PCS_NAD27_Montana_North,	32001)
+ValuePair(PCS_NAD27_Montana_Central,	32002)
+ValuePair(PCS_NAD27_Montana_South,	32003)
+ValuePair(PCS_NAD27_Nebraska_North,	32005)
+ValuePair(PCS_NAD27_Nebraska_South,	32006)
+ValuePair(PCS_NAD27_Nevada_East,	32007)
+ValuePair(PCS_NAD27_Nevada_Central,	32008)
+ValuePair(PCS_NAD27_Nevada_West,	32009)
+ValuePair(PCS_NAD27_New_Hampshire,	32010)
+ValuePair(PCS_NAD27_New_Jersey,	32011)
+ValuePair(PCS_NAD27_New_Mexico_East,	32012)
+ValuePair(PCS_NAD27_New_Mexico_Cent,	32013)
+ValuePair(PCS_NAD27_New_Mexico_West,	32014)
+ValuePair(PCS_NAD27_New_York_East,	32015)
+ValuePair(PCS_NAD27_New_York_Central,	32016)
+ValuePair(PCS_NAD27_New_York_West,	32017)
+ValuePair(PCS_NAD27_New_York_Long_Is,	32018)
+ValuePair(PCS_NAD27_North_Carolina,	32019)
+ValuePair(PCS_NAD27_North_Dakota_N,	32020)
+ValuePair(PCS_NAD27_North_Dakota_S,	32021)
+ValuePair(PCS_NAD27_Ohio_North,	32022)
+ValuePair(PCS_NAD27_Ohio_South,	32023)
+ValuePair(PCS_NAD27_Oklahoma_North,	32024)
+ValuePair(PCS_NAD27_Oklahoma_South,	32025)
+ValuePair(PCS_NAD27_Oregon_North,	32026)
+ValuePair(PCS_NAD27_Oregon_South,	32027)
+ValuePair(PCS_NAD27_Pennsylvania_N,	32028)
+ValuePair(PCS_NAD27_Pennsylvania_S,	32029)
+ValuePair(PCS_NAD27_Rhode_Island,	32030)
+ValuePair(PCS_NAD27_South_Carolina_N,	32031)
+ValuePair(PCS_NAD27_South_Carolina_S,	32033)
+ValuePair(PCS_NAD27_South_Dakota_N,	32034)
+ValuePair(PCS_NAD27_South_Dakota_S,	32035)
+ValuePair(PCS_NAD27_Tennessee,		2204)
+ValuePair(PCS_NAD27_Texas_North,	32037)
+ValuePair(PCS_NAD27_Texas_North_Cen,	32038)
+ValuePair(PCS_NAD27_Texas_Central,	32039)
+ValuePair(PCS_NAD27_Texas_South_Cen,	32040)
+ValuePair(PCS_NAD27_Texas_South,	32041)
+ValuePair(PCS_NAD27_Utah_North,	32042)
+ValuePair(PCS_NAD27_Utah_Central,	32043)
+ValuePair(PCS_NAD27_Utah_South,	32044)
+ValuePair(PCS_NAD27_Vermont,	32045)
+ValuePair(PCS_NAD27_Virginia_North,	32046)
+ValuePair(PCS_NAD27_Virginia_South,	32047)
+ValuePair(PCS_NAD27_Washington_North,	32048)
+ValuePair(PCS_NAD27_Washington_South,	32049)
+ValuePair(PCS_NAD27_West_Virginia_N,	32050)
+ValuePair(PCS_NAD27_West_Virginia_S,	32051)
+ValuePair(PCS_NAD27_Wisconsin_North,	32052)
+ValuePair(PCS_NAD27_Wisconsin_Cen,	32053)
+ValuePair(PCS_NAD27_Wisconsin_South,	32054)
+ValuePair(PCS_NAD27_Wyoming_East,	32055)
+ValuePair(PCS_NAD27_Wyoming_E_Cen,	32056)
+ValuePair(PCS_NAD27_Wyoming_W_Cen,	32057)
+ValuePair(PCS_NAD27_Wyoming_West,	32058)
+ValuePair(PCS_NAD27_Puerto_Rico,	32059)
+ValuePair(PCS_NAD27_St_Croix,	32060)
+ValuePair(PCS_NAD83_Montana,	32100)
+ValuePair(PCS_NAD83_Nebraska,	32104)
+ValuePair(PCS_NAD83_Nevada_East,	32107)
+ValuePair(PCS_NAD83_Nevada_Central,	32108)
+ValuePair(PCS_NAD83_Nevada_West,	32109)
+ValuePair(PCS_NAD83_New_Hampshire,	32110)
+ValuePair(PCS_NAD83_New_Jersey,	32111)
+ValuePair(PCS_NAD83_New_Mexico_East,	32112)
+ValuePair(PCS_NAD83_New_Mexico_Cent,	32113)
+ValuePair(PCS_NAD83_New_Mexico_West,	32114)
+ValuePair(PCS_NAD83_New_York_East,	32115)
+ValuePair(PCS_NAD83_New_York_Central,	32116)
+ValuePair(PCS_NAD83_New_York_West,	32117)
+ValuePair(PCS_NAD83_New_York_Long_Is,	32118)
+ValuePair(PCS_NAD83_North_Carolina,	32119)
+ValuePair(PCS_NAD83_North_Dakota_N,	32120)
+ValuePair(PCS_NAD83_North_Dakota_S,	32121)
+ValuePair(PCS_NAD83_Ohio_North,	32122)
+ValuePair(PCS_NAD83_Ohio_South,	32123)
+ValuePair(PCS_NAD83_Oklahoma_North,	32124)
+ValuePair(PCS_NAD83_Oklahoma_South,	32125)
+ValuePair(PCS_NAD83_Oregon_North,	32126)
+ValuePair(PCS_NAD83_Oregon_South,	32127)
+ValuePair(PCS_NAD83_Pennsylvania_N,	32128)
+ValuePair(PCS_NAD83_Pennsylvania_S,	32129)
+ValuePair(PCS_NAD83_Rhode_Island,	32130)
+ValuePair(PCS_NAD83_South_Carolina,	32133)
+ValuePair(PCS_NAD83_South_Dakota_N,	32134)
+ValuePair(PCS_NAD83_South_Dakota_S,	32135)
+ValuePair(PCS_NAD83_Tennessee,	32136)
+ValuePair(PCS_NAD83_Texas_North,	32137)
+ValuePair(PCS_NAD83_Texas_North_Cen,	32138)
+ValuePair(PCS_NAD83_Texas_Central,	32139)
+ValuePair(PCS_NAD83_Texas_South_Cen,	32140)
+ValuePair(PCS_NAD83_Texas_South,	32141)
+ValuePair(PCS_NAD83_Utah_North,	32142)
+ValuePair(PCS_NAD83_Utah_Central,	32143)
+ValuePair(PCS_NAD83_Utah_South,	32144)
+ValuePair(PCS_NAD83_Vermont,	32145)
+ValuePair(PCS_NAD83_Virginia_North,	32146)
+ValuePair(PCS_NAD83_Virginia_South,	32147)
+ValuePair(PCS_NAD83_Washington_North,	32148)
+ValuePair(PCS_NAD83_Washington_South,	32149)
+ValuePair(PCS_NAD83_West_Virginia_N,	32150)
+ValuePair(PCS_NAD83_West_Virginia_S,	32151)
+ValuePair(PCS_NAD83_Wisconsin_North,	32152)
+ValuePair(PCS_NAD83_Wisconsin_Cen,	32153)
+ValuePair(PCS_NAD83_Wisconsin_South,	32154)
+ValuePair(PCS_NAD83_Wyoming_East,	32155)
+ValuePair(PCS_NAD83_Wyoming_E_Cen,	32156)
+ValuePair(PCS_NAD83_Wyoming_W_Cen,	32157)
+ValuePair(PCS_NAD83_Wyoming_West,	32158)
+ValuePair(PCS_NAD83_Puerto_Rico_Virgin_Is,	32161)
+ValuePair(PCS_WGS72_UTM_zone_1N,	32201)
+ValuePair(PCS_WGS72_UTM_zone_2N,	32202)
+ValuePair(PCS_WGS72_UTM_zone_3N,	32203)
+ValuePair(PCS_WGS72_UTM_zone_4N,	32204)
+ValuePair(PCS_WGS72_UTM_zone_5N,	32205)
+ValuePair(PCS_WGS72_UTM_zone_6N,	32206)
+ValuePair(PCS_WGS72_UTM_zone_7N,	32207)
+ValuePair(PCS_WGS72_UTM_zone_8N,	32208)
+ValuePair(PCS_WGS72_UTM_zone_9N,	32209)
+ValuePair(PCS_WGS72_UTM_zone_10N,	32210)
+ValuePair(PCS_WGS72_UTM_zone_11N,	32211)
+ValuePair(PCS_WGS72_UTM_zone_12N,	32212)
+ValuePair(PCS_WGS72_UTM_zone_13N,	32213)
+ValuePair(PCS_WGS72_UTM_zone_14N,	32214)
+ValuePair(PCS_WGS72_UTM_zone_15N,	32215)
+ValuePair(PCS_WGS72_UTM_zone_16N,	32216)
+ValuePair(PCS_WGS72_UTM_zone_17N,	32217)
+ValuePair(PCS_WGS72_UTM_zone_18N,	32218)
+ValuePair(PCS_WGS72_UTM_zone_19N,	32219)
+ValuePair(PCS_WGS72_UTM_zone_20N,	32220)
+ValuePair(PCS_WGS72_UTM_zone_21N,	32221)
+ValuePair(PCS_WGS72_UTM_zone_22N,	32222)
+ValuePair(PCS_WGS72_UTM_zone_23N,	32223)
+ValuePair(PCS_WGS72_UTM_zone_24N,	32224)
+ValuePair(PCS_WGS72_UTM_zone_25N,	32225)
+ValuePair(PCS_WGS72_UTM_zone_26N,	32226)
+ValuePair(PCS_WGS72_UTM_zone_27N,	32227)
+ValuePair(PCS_WGS72_UTM_zone_28N,	32228)
+ValuePair(PCS_WGS72_UTM_zone_29N,	32229)
+ValuePair(PCS_WGS72_UTM_zone_30N,	32230)
+ValuePair(PCS_WGS72_UTM_zone_31N,	32231)
+ValuePair(PCS_WGS72_UTM_zone_32N,	32232)
+ValuePair(PCS_WGS72_UTM_zone_33N,	32233)
+ValuePair(PCS_WGS72_UTM_zone_34N,	32234)
+ValuePair(PCS_WGS72_UTM_zone_35N,	32235)
+ValuePair(PCS_WGS72_UTM_zone_36N,	32236)
+ValuePair(PCS_WGS72_UTM_zone_37N,	32237)
+ValuePair(PCS_WGS72_UTM_zone_38N,	32238)
+ValuePair(PCS_WGS72_UTM_zone_39N,	32239)
+ValuePair(PCS_WGS72_UTM_zone_40N,	32240)
+ValuePair(PCS_WGS72_UTM_zone_41N,	32241)
+ValuePair(PCS_WGS72_UTM_zone_42N,	32242)
+ValuePair(PCS_WGS72_UTM_zone_43N,	32243)
+ValuePair(PCS_WGS72_UTM_zone_44N,	32244)
+ValuePair(PCS_WGS72_UTM_zone_45N,	32245)
+ValuePair(PCS_WGS72_UTM_zone_46N,	32246)
+ValuePair(PCS_WGS72_UTM_zone_47N,	32247)
+ValuePair(PCS_WGS72_UTM_zone_48N,	32248)
+ValuePair(PCS_WGS72_UTM_zone_49N,	32249)
+ValuePair(PCS_WGS72_UTM_zone_50N,	32250)
+ValuePair(PCS_WGS72_UTM_zone_51N,	32251)
+ValuePair(PCS_WGS72_UTM_zone_52N,	32252)
+ValuePair(PCS_WGS72_UTM_zone_53N,	32253)
+ValuePair(PCS_WGS72_UTM_zone_54N,	32254)
+ValuePair(PCS_WGS72_UTM_zone_55N,	32255)
+ValuePair(PCS_WGS72_UTM_zone_56N,	32256)
+ValuePair(PCS_WGS72_UTM_zone_57N,	32257)
+ValuePair(PCS_WGS72_UTM_zone_58N,	32258)
+ValuePair(PCS_WGS72_UTM_zone_59N,	32259)
+ValuePair(PCS_WGS72_UTM_zone_60N,	32260)
+ValuePair(PCS_WGS72_UTM_zone_1S,	32301)
+ValuePair(PCS_WGS72_UTM_zone_2S,	32302)
+ValuePair(PCS_WGS72_UTM_zone_3S,	32303)
+ValuePair(PCS_WGS72_UTM_zone_4S,	32304)
+ValuePair(PCS_WGS72_UTM_zone_5S,	32305)
+ValuePair(PCS_WGS72_UTM_zone_6S,	32306)
+ValuePair(PCS_WGS72_UTM_zone_7S,	32307)
+ValuePair(PCS_WGS72_UTM_zone_8S,	32308)
+ValuePair(PCS_WGS72_UTM_zone_9S,	32309)
+ValuePair(PCS_WGS72_UTM_zone_10S,	32310)
+ValuePair(PCS_WGS72_UTM_zone_11S,	32311)
+ValuePair(PCS_WGS72_UTM_zone_12S,	32312)
+ValuePair(PCS_WGS72_UTM_zone_13S,	32313)
+ValuePair(PCS_WGS72_UTM_zone_14S,	32314)
+ValuePair(PCS_WGS72_UTM_zone_15S,	32315)
+ValuePair(PCS_WGS72_UTM_zone_16S,	32316)
+ValuePair(PCS_WGS72_UTM_zone_17S,	32317)
+ValuePair(PCS_WGS72_UTM_zone_18S,	32318)
+ValuePair(PCS_WGS72_UTM_zone_19S,	32319)
+ValuePair(PCS_WGS72_UTM_zone_20S,	32320)
+ValuePair(PCS_WGS72_UTM_zone_21S,	32321)
+ValuePair(PCS_WGS72_UTM_zone_22S,	32322)
+ValuePair(PCS_WGS72_UTM_zone_23S,	32323)
+ValuePair(PCS_WGS72_UTM_zone_24S,	32324)
+ValuePair(PCS_WGS72_UTM_zone_25S,	32325)
+ValuePair(PCS_WGS72_UTM_zone_26S,	32326)
+ValuePair(PCS_WGS72_UTM_zone_27S,	32327)
+ValuePair(PCS_WGS72_UTM_zone_28S,	32328)
+ValuePair(PCS_WGS72_UTM_zone_29S,	32329)
+ValuePair(PCS_WGS72_UTM_zone_30S,	32330)
+ValuePair(PCS_WGS72_UTM_zone_31S,	32331)
+ValuePair(PCS_WGS72_UTM_zone_32S,	32332)
+ValuePair(PCS_WGS72_UTM_zone_33S,	32333)
+ValuePair(PCS_WGS72_UTM_zone_34S,	32334)
+ValuePair(PCS_WGS72_UTM_zone_35S,	32335)
+ValuePair(PCS_WGS72_UTM_zone_36S,	32336)
+ValuePair(PCS_WGS72_UTM_zone_37S,	32337)
+ValuePair(PCS_WGS72_UTM_zone_38S,	32338)
+ValuePair(PCS_WGS72_UTM_zone_39S,	32339)
+ValuePair(PCS_WGS72_UTM_zone_40S,	32340)
+ValuePair(PCS_WGS72_UTM_zone_41S,	32341)
+ValuePair(PCS_WGS72_UTM_zone_42S,	32342)
+ValuePair(PCS_WGS72_UTM_zone_43S,	32343)
+ValuePair(PCS_WGS72_UTM_zone_44S,	32344)
+ValuePair(PCS_WGS72_UTM_zone_45S,	32345)
+ValuePair(PCS_WGS72_UTM_zone_46S,	32346)
+ValuePair(PCS_WGS72_UTM_zone_47S,	32347)
+ValuePair(PCS_WGS72_UTM_zone_48S,	32348)
+ValuePair(PCS_WGS72_UTM_zone_49S,	32349)
+ValuePair(PCS_WGS72_UTM_zone_50S,	32350)
+ValuePair(PCS_WGS72_UTM_zone_51S,	32351)
+ValuePair(PCS_WGS72_UTM_zone_52S,	32352)
+ValuePair(PCS_WGS72_UTM_zone_53S,	32353)
+ValuePair(PCS_WGS72_UTM_zone_54S,	32354)
+ValuePair(PCS_WGS72_UTM_zone_55S,	32355)
+ValuePair(PCS_WGS72_UTM_zone_56S,	32356)
+ValuePair(PCS_WGS72_UTM_zone_57S,	32357)
+ValuePair(PCS_WGS72_UTM_zone_58S,	32358)
+ValuePair(PCS_WGS72_UTM_zone_59S,	32359)
+ValuePair(PCS_WGS72_UTM_zone_60S,	32360)
+ValuePair(PCS_WGS72BE_UTM_zone_1N,	32401)
+ValuePair(PCS_WGS72BE_UTM_zone_2N,	32402)
+ValuePair(PCS_WGS72BE_UTM_zone_3N,	32403)
+ValuePair(PCS_WGS72BE_UTM_zone_4N,	32404)
+ValuePair(PCS_WGS72BE_UTM_zone_5N,	32405)
+ValuePair(PCS_WGS72BE_UTM_zone_6N,	32406)
+ValuePair(PCS_WGS72BE_UTM_zone_7N,	32407)
+ValuePair(PCS_WGS72BE_UTM_zone_8N,	32408)
+ValuePair(PCS_WGS72BE_UTM_zone_9N,	32409)
+ValuePair(PCS_WGS72BE_UTM_zone_10N,	32410)
+ValuePair(PCS_WGS72BE_UTM_zone_11N,	32411)
+ValuePair(PCS_WGS72BE_UTM_zone_12N,	32412)
+ValuePair(PCS_WGS72BE_UTM_zone_13N,	32413)
+ValuePair(PCS_WGS72BE_UTM_zone_14N,	32414)
+ValuePair(PCS_WGS72BE_UTM_zone_15N,	32415)
+ValuePair(PCS_WGS72BE_UTM_zone_16N,	32416)
+ValuePair(PCS_WGS72BE_UTM_zone_17N,	32417)
+ValuePair(PCS_WGS72BE_UTM_zone_18N,	32418)
+ValuePair(PCS_WGS72BE_UTM_zone_19N,	32419)
+ValuePair(PCS_WGS72BE_UTM_zone_20N,	32420)
+ValuePair(PCS_WGS72BE_UTM_zone_21N,	32421)
+ValuePair(PCS_WGS72BE_UTM_zone_22N,	32422)
+ValuePair(PCS_WGS72BE_UTM_zone_23N,	32423)
+ValuePair(PCS_WGS72BE_UTM_zone_24N,	32424)
+ValuePair(PCS_WGS72BE_UTM_zone_25N,	32425)
+ValuePair(PCS_WGS72BE_UTM_zone_26N,	32426)
+ValuePair(PCS_WGS72BE_UTM_zone_27N,	32427)
+ValuePair(PCS_WGS72BE_UTM_zone_28N,	32428)
+ValuePair(PCS_WGS72BE_UTM_zone_29N,	32429)
+ValuePair(PCS_WGS72BE_UTM_zone_30N,	32430)
+ValuePair(PCS_WGS72BE_UTM_zone_31N,	32431)
+ValuePair(PCS_WGS72BE_UTM_zone_32N,	32432)
+ValuePair(PCS_WGS72BE_UTM_zone_33N,	32433)
+ValuePair(PCS_WGS72BE_UTM_zone_34N,	32434)
+ValuePair(PCS_WGS72BE_UTM_zone_35N,	32435)
+ValuePair(PCS_WGS72BE_UTM_zone_36N,	32436)
+ValuePair(PCS_WGS72BE_UTM_zone_37N,	32437)
+ValuePair(PCS_WGS72BE_UTM_zone_38N,	32438)
+ValuePair(PCS_WGS72BE_UTM_zone_39N,	32439)
+ValuePair(PCS_WGS72BE_UTM_zone_40N,	32440)
+ValuePair(PCS_WGS72BE_UTM_zone_41N,	32441)
+ValuePair(PCS_WGS72BE_UTM_zone_42N,	32442)
+ValuePair(PCS_WGS72BE_UTM_zone_43N,	32443)
+ValuePair(PCS_WGS72BE_UTM_zone_44N,	32444)
+ValuePair(PCS_WGS72BE_UTM_zone_45N,	32445)
+ValuePair(PCS_WGS72BE_UTM_zone_46N,	32446)
+ValuePair(PCS_WGS72BE_UTM_zone_47N,	32447)
+ValuePair(PCS_WGS72BE_UTM_zone_48N,	32448)
+ValuePair(PCS_WGS72BE_UTM_zone_49N,	32449)
+ValuePair(PCS_WGS72BE_UTM_zone_50N,	32450)
+ValuePair(PCS_WGS72BE_UTM_zone_51N,	32451)
+ValuePair(PCS_WGS72BE_UTM_zone_52N,	32452)
+ValuePair(PCS_WGS72BE_UTM_zone_53N,	32453)
+ValuePair(PCS_WGS72BE_UTM_zone_54N,	32454)
+ValuePair(PCS_WGS72BE_UTM_zone_55N,	32455)
+ValuePair(PCS_WGS72BE_UTM_zone_56N,	32456)
+ValuePair(PCS_WGS72BE_UTM_zone_57N,	32457)
+ValuePair(PCS_WGS72BE_UTM_zone_58N,	32458)
+ValuePair(PCS_WGS72BE_UTM_zone_59N,	32459)
+ValuePair(PCS_WGS72BE_UTM_zone_60N,	32460)
+ValuePair(PCS_WGS72BE_UTM_zone_1S,	32501)
+ValuePair(PCS_WGS72BE_UTM_zone_2S,	32502)
+ValuePair(PCS_WGS72BE_UTM_zone_3S,	32503)
+ValuePair(PCS_WGS72BE_UTM_zone_4S,	32504)
+ValuePair(PCS_WGS72BE_UTM_zone_5S,	32505)
+ValuePair(PCS_WGS72BE_UTM_zone_6S,	32506)
+ValuePair(PCS_WGS72BE_UTM_zone_7S,	32507)
+ValuePair(PCS_WGS72BE_UTM_zone_8S,	32508)
+ValuePair(PCS_WGS72BE_UTM_zone_9S,	32509)
+ValuePair(PCS_WGS72BE_UTM_zone_10S,	32510)
+ValuePair(PCS_WGS72BE_UTM_zone_11S,	32511)
+ValuePair(PCS_WGS72BE_UTM_zone_12S,	32512)
+ValuePair(PCS_WGS72BE_UTM_zone_13S,	32513)
+ValuePair(PCS_WGS72BE_UTM_zone_14S,	32514)
+ValuePair(PCS_WGS72BE_UTM_zone_15S,	32515)
+ValuePair(PCS_WGS72BE_UTM_zone_16S,	32516)
+ValuePair(PCS_WGS72BE_UTM_zone_17S,	32517)
+ValuePair(PCS_WGS72BE_UTM_zone_18S,	32518)
+ValuePair(PCS_WGS72BE_UTM_zone_19S,	32519)
+ValuePair(PCS_WGS72BE_UTM_zone_20S,	32520)
+ValuePair(PCS_WGS72BE_UTM_zone_21S,	32521)
+ValuePair(PCS_WGS72BE_UTM_zone_22S,	32522)
+ValuePair(PCS_WGS72BE_UTM_zone_23S,	32523)
+ValuePair(PCS_WGS72BE_UTM_zone_24S,	32524)
+ValuePair(PCS_WGS72BE_UTM_zone_25S,	32525)
+ValuePair(PCS_WGS72BE_UTM_zone_26S,	32526)
+ValuePair(PCS_WGS72BE_UTM_zone_27S,	32527)
+ValuePair(PCS_WGS72BE_UTM_zone_28S,	32528)
+ValuePair(PCS_WGS72BE_UTM_zone_29S,	32529)
+ValuePair(PCS_WGS72BE_UTM_zone_30S,	32530)
+ValuePair(PCS_WGS72BE_UTM_zone_31S,	32531)
+ValuePair(PCS_WGS72BE_UTM_zone_32S,	32532)
+ValuePair(PCS_WGS72BE_UTM_zone_33S,	32533)
+ValuePair(PCS_WGS72BE_UTM_zone_34S,	32534)
+ValuePair(PCS_WGS72BE_UTM_zone_35S,	32535)
+ValuePair(PCS_WGS72BE_UTM_zone_36S,	32536)
+ValuePair(PCS_WGS72BE_UTM_zone_37S,	32537)
+ValuePair(PCS_WGS72BE_UTM_zone_38S,	32538)
+ValuePair(PCS_WGS72BE_UTM_zone_39S,	32539)
+ValuePair(PCS_WGS72BE_UTM_zone_40S,	32540)
+ValuePair(PCS_WGS72BE_UTM_zone_41S,	32541)
+ValuePair(PCS_WGS72BE_UTM_zone_42S,	32542)
+ValuePair(PCS_WGS72BE_UTM_zone_43S,	32543)
+ValuePair(PCS_WGS72BE_UTM_zone_44S,	32544)
+ValuePair(PCS_WGS72BE_UTM_zone_45S,	32545)
+ValuePair(PCS_WGS72BE_UTM_zone_46S,	32546)
+ValuePair(PCS_WGS72BE_UTM_zone_47S,	32547)
+ValuePair(PCS_WGS72BE_UTM_zone_48S,	32548)
+ValuePair(PCS_WGS72BE_UTM_zone_49S,	32549)
+ValuePair(PCS_WGS72BE_UTM_zone_50S,	32550)
+ValuePair(PCS_WGS72BE_UTM_zone_51S,	32551)
+ValuePair(PCS_WGS72BE_UTM_zone_52S,	32552)
+ValuePair(PCS_WGS72BE_UTM_zone_53S,	32553)
+ValuePair(PCS_WGS72BE_UTM_zone_54S,	32554)
+ValuePair(PCS_WGS72BE_UTM_zone_55S,	32555)
+ValuePair(PCS_WGS72BE_UTM_zone_56S,	32556)
+ValuePair(PCS_WGS72BE_UTM_zone_57S,	32557)
+ValuePair(PCS_WGS72BE_UTM_zone_58S,	32558)
+ValuePair(PCS_WGS72BE_UTM_zone_59S,	32559)
+ValuePair(PCS_WGS72BE_UTM_zone_60S,	32560)
+ValuePair(PCS_WGS84_UTM_zone_1N,	32601)
+ValuePair(PCS_WGS84_UTM_zone_2N,	32602)
+ValuePair(PCS_WGS84_UTM_zone_3N,	32603)
+ValuePair(PCS_WGS84_UTM_zone_4N,	32604)
+ValuePair(PCS_WGS84_UTM_zone_5N,	32605)
+ValuePair(PCS_WGS84_UTM_zone_6N,	32606)
+ValuePair(PCS_WGS84_UTM_zone_7N,	32607)
+ValuePair(PCS_WGS84_UTM_zone_8N,	32608)
+ValuePair(PCS_WGS84_UTM_zone_9N,	32609)
+ValuePair(PCS_WGS84_UTM_zone_10N,	32610)
+ValuePair(PCS_WGS84_UTM_zone_11N,	32611)
+ValuePair(PCS_WGS84_UTM_zone_12N,	32612)
+ValuePair(PCS_WGS84_UTM_zone_13N,	32613)
+ValuePair(PCS_WGS84_UTM_zone_14N,	32614)
+ValuePair(PCS_WGS84_UTM_zone_15N,	32615)
+ValuePair(PCS_WGS84_UTM_zone_16N,	32616)
+ValuePair(PCS_WGS84_UTM_zone_17N,	32617)
+ValuePair(PCS_WGS84_UTM_zone_18N,	32618)
+ValuePair(PCS_WGS84_UTM_zone_19N,	32619)
+ValuePair(PCS_WGS84_UTM_zone_20N,	32620)
+ValuePair(PCS_WGS84_UTM_zone_21N,	32621)
+ValuePair(PCS_WGS84_UTM_zone_22N,	32622)
+ValuePair(PCS_WGS84_UTM_zone_23N,	32623)
+ValuePair(PCS_WGS84_UTM_zone_24N,	32624)
+ValuePair(PCS_WGS84_UTM_zone_25N,	32625)
+ValuePair(PCS_WGS84_UTM_zone_26N,	32626)
+ValuePair(PCS_WGS84_UTM_zone_27N,	32627)
+ValuePair(PCS_WGS84_UTM_zone_28N,	32628)
+ValuePair(PCS_WGS84_UTM_zone_29N,	32629)
+ValuePair(PCS_WGS84_UTM_zone_30N,	32630)
+ValuePair(PCS_WGS84_UTM_zone_31N,	32631)
+ValuePair(PCS_WGS84_UTM_zone_32N,	32632)
+ValuePair(PCS_WGS84_UTM_zone_33N,	32633)
+ValuePair(PCS_WGS84_UTM_zone_34N,	32634)
+ValuePair(PCS_WGS84_UTM_zone_35N,	32635)
+ValuePair(PCS_WGS84_UTM_zone_36N,	32636)
+ValuePair(PCS_WGS84_UTM_zone_37N,	32637)
+ValuePair(PCS_WGS84_UTM_zone_38N,	32638)
+ValuePair(PCS_WGS84_UTM_zone_39N,	32639)
+ValuePair(PCS_WGS84_UTM_zone_40N,	32640)
+ValuePair(PCS_WGS84_UTM_zone_41N,	32641)
+ValuePair(PCS_WGS84_UTM_zone_42N,	32642)
+ValuePair(PCS_WGS84_UTM_zone_43N,	32643)
+ValuePair(PCS_WGS84_UTM_zone_44N,	32644)
+ValuePair(PCS_WGS84_UTM_zone_45N,	32645)
+ValuePair(PCS_WGS84_UTM_zone_46N,	32646)
+ValuePair(PCS_WGS84_UTM_zone_47N,	32647)
+ValuePair(PCS_WGS84_UTM_zone_48N,	32648)
+ValuePair(PCS_WGS84_UTM_zone_49N,	32649)
+ValuePair(PCS_WGS84_UTM_zone_50N,	32650)
+ValuePair(PCS_WGS84_UTM_zone_51N,	32651)
+ValuePair(PCS_WGS84_UTM_zone_52N,	32652)
+ValuePair(PCS_WGS84_UTM_zone_53N,	32653)
+ValuePair(PCS_WGS84_UTM_zone_54N,	32654)
+ValuePair(PCS_WGS84_UTM_zone_55N,	32655)
+ValuePair(PCS_WGS84_UTM_zone_56N,	32656)
+ValuePair(PCS_WGS84_UTM_zone_57N,	32657)
+ValuePair(PCS_WGS84_UTM_zone_58N,	32658)
+ValuePair(PCS_WGS84_UTM_zone_59N,	32659)
+ValuePair(PCS_WGS84_UTM_zone_60N,	32660)
+ValuePair(PCS_WGS84_UTM_zone_1S,	32701)
+ValuePair(PCS_WGS84_UTM_zone_2S,	32702)
+ValuePair(PCS_WGS84_UTM_zone_3S,	32703)
+ValuePair(PCS_WGS84_UTM_zone_4S,	32704)
+ValuePair(PCS_WGS84_UTM_zone_5S,	32705)
+ValuePair(PCS_WGS84_UTM_zone_6S,	32706)
+ValuePair(PCS_WGS84_UTM_zone_7S,	32707)
+ValuePair(PCS_WGS84_UTM_zone_8S,	32708)
+ValuePair(PCS_WGS84_UTM_zone_9S,	32709)
+ValuePair(PCS_WGS84_UTM_zone_10S,	32710)
+ValuePair(PCS_WGS84_UTM_zone_11S,	32711)
+ValuePair(PCS_WGS84_UTM_zone_12S,	32712)
+ValuePair(PCS_WGS84_UTM_zone_13S,	32713)
+ValuePair(PCS_WGS84_UTM_zone_14S,	32714)
+ValuePair(PCS_WGS84_UTM_zone_15S,	32715)
+ValuePair(PCS_WGS84_UTM_zone_16S,	32716)
+ValuePair(PCS_WGS84_UTM_zone_17S,	32717)
+ValuePair(PCS_WGS84_UTM_zone_18S,	32718)
+ValuePair(PCS_WGS84_UTM_zone_19S,	32719)
+ValuePair(PCS_WGS84_UTM_zone_20S,	32720)
+ValuePair(PCS_WGS84_UTM_zone_21S,	32721)
+ValuePair(PCS_WGS84_UTM_zone_22S,	32722)
+ValuePair(PCS_WGS84_UTM_zone_23S,	32723)
+ValuePair(PCS_WGS84_UTM_zone_24S,	32724)
+ValuePair(PCS_WGS84_UTM_zone_25S,	32725)
+ValuePair(PCS_WGS84_UTM_zone_26S,	32726)
+ValuePair(PCS_WGS84_UTM_zone_27S,	32727)
+ValuePair(PCS_WGS84_UTM_zone_28S,	32728)
+ValuePair(PCS_WGS84_UTM_zone_29S,	32729)
+ValuePair(PCS_WGS84_UTM_zone_30S,	32730)
+ValuePair(PCS_WGS84_UTM_zone_31S,	32731)
+ValuePair(PCS_WGS84_UTM_zone_32S,	32732)
+ValuePair(PCS_WGS84_UTM_zone_33S,	32733)
+ValuePair(PCS_WGS84_UTM_zone_34S,	32734)
+ValuePair(PCS_WGS84_UTM_zone_35S,	32735)
+ValuePair(PCS_WGS84_UTM_zone_36S,	32736)
+ValuePair(PCS_WGS84_UTM_zone_37S,	32737)
+ValuePair(PCS_WGS84_UTM_zone_38S,	32738)
+ValuePair(PCS_WGS84_UTM_zone_39S,	32739)
+ValuePair(PCS_WGS84_UTM_zone_40S,	32740)
+ValuePair(PCS_WGS84_UTM_zone_41S,	32741)
+ValuePair(PCS_WGS84_UTM_zone_42S,	32742)
+ValuePair(PCS_WGS84_UTM_zone_43S,	32743)
+ValuePair(PCS_WGS84_UTM_zone_44S,	32744)
+ValuePair(PCS_WGS84_UTM_zone_45S,	32745)
+ValuePair(PCS_WGS84_UTM_zone_46S,	32746)
+ValuePair(PCS_WGS84_UTM_zone_47S,	32747)
+ValuePair(PCS_WGS84_UTM_zone_48S,	32748)
+ValuePair(PCS_WGS84_UTM_zone_49S,	32749)
+ValuePair(PCS_WGS84_UTM_zone_50S,	32750)
+ValuePair(PCS_WGS84_UTM_zone_51S,	32751)
+ValuePair(PCS_WGS84_UTM_zone_52S,	32752)
+ValuePair(PCS_WGS84_UTM_zone_53S,	32753)
+ValuePair(PCS_WGS84_UTM_zone_54S,	32754)
+ValuePair(PCS_WGS84_UTM_zone_55S,	32755)
+ValuePair(PCS_WGS84_UTM_zone_56S,	32756)
+ValuePair(PCS_WGS84_UTM_zone_57S,	32757)
+ValuePair(PCS_WGS84_UTM_zone_58S,	32758)
+ValuePair(PCS_WGS84_UTM_zone_59S,	32759)
+ValuePair(PCS_WGS84_UTM_zone_60S,	32760)
+/* end of list */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_pm.inc
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_pm.inc	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_pm.inc	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,22 @@
+/* EPSG/GeoTIFF Rev 0.2 Prime Meridian Database */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_pm.inc
+#endif /* OLD Codes */
+
+ValuePair(PM_Greenwich,	8901)
+ValuePair(PM_Lisbon,	8902)
+ValuePair(PM_Paris,	8903)
+ValuePair(PM_Bogota,	8904)
+ValuePair(PM_Madrid,	8905)
+ValuePair(PM_Rome,	8906)
+ValuePair(PM_Bern,	8907)
+ValuePair(PM_Jakarta,	8908)
+ValuePair(PM_Ferro,	8909)
+ValuePair(PM_Brussels,	8910)
+ValuePair(PM_Stockholm,	8911)
+/* end of list */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_proj.inc
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_proj.inc	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_proj.inc	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,443 @@
+/*
+ *  EPSG/POSC Projection Codes - GeoTIFF Rev 0.2
+ */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_proj.inc
+#endif /* OLD Codes */
+
+/* New codes */
+
+ValuePair(Proj_Stereo_70,19926)
+
+/* old codes */
+
+ValuePair(Proj_Alabama_CS27_East,	10101)
+ValuePair(Proj_Alabama_CS27_West,	10102)
+ValuePair(Proj_Alabama_CS83_East,	10131)
+ValuePair(Proj_Alabama_CS83_West,	10132)
+ValuePair(Proj_Arizona_Coordinate_System_east,	10201)
+ValuePair(Proj_Arizona_Coordinate_System_Central,	10202)
+ValuePair(Proj_Arizona_Coordinate_System_west,	10203)
+ValuePair(Proj_Arizona_CS83_east,	10231)
+ValuePair(Proj_Arizona_CS83_Central,	10232)
+ValuePair(Proj_Arizona_CS83_west,	10233)
+ValuePair(Proj_Arkansas_CS27_North,	10301)
+ValuePair(Proj_Arkansas_CS27_South,	10302)
+ValuePair(Proj_Arkansas_CS83_North,	10331)
+ValuePair(Proj_Arkansas_CS83_South,	10332)
+ValuePair(Proj_California_CS27_I,	10401)
+ValuePair(Proj_California_CS27_II,	10402)
+ValuePair(Proj_California_CS27_III,	10403)
+ValuePair(Proj_California_CS27_IV,	10404)
+ValuePair(Proj_California_CS27_V,	10405)
+ValuePair(Proj_California_CS27_VI,	10406)
+ValuePair(Proj_California_CS27_VII,	10407)
+ValuePair(Proj_California_CS83_1,	10431)
+ValuePair(Proj_California_CS83_2,	10432)
+ValuePair(Proj_California_CS83_3,	10433)
+ValuePair(Proj_California_CS83_4,	10434)
+ValuePair(Proj_California_CS83_5,	10435)
+ValuePair(Proj_California_CS83_6,	10436)
+ValuePair(Proj_Colorado_CS27_North,	10501)
+ValuePair(Proj_Colorado_CS27_Central,	10502)
+ValuePair(Proj_Colorado_CS27_South,	10503)
+ValuePair(Proj_Colorado_CS83_North,	10531)
+ValuePair(Proj_Colorado_CS83_Central,	10532)
+ValuePair(Proj_Colorado_CS83_South,	10533)
+ValuePair(Proj_Connecticut_CS27,	10600)
+ValuePair(Proj_Connecticut_CS83,	10630)
+ValuePair(Proj_Delaware_CS27,	10700)
+ValuePair(Proj_Delaware_CS83,	10730)
+ValuePair(Proj_Florida_CS27_East,	10901)
+ValuePair(Proj_Florida_CS27_West,	10902)
+ValuePair(Proj_Florida_CS27_North,	10903)
+ValuePair(Proj_Florida_CS83_East,	10931)
+ValuePair(Proj_Florida_CS83_West,	10932)
+ValuePair(Proj_Florida_CS83_North,	10933)
+ValuePair(Proj_Georgia_CS27_East,	11001)
+ValuePair(Proj_Georgia_CS27_West,	11002)
+ValuePair(Proj_Georgia_CS83_East,	11031)
+ValuePair(Proj_Georgia_CS83_West,	11032)
+ValuePair(Proj_Idaho_CS27_East,	11101)
+ValuePair(Proj_Idaho_CS27_Central,	11102)
+ValuePair(Proj_Idaho_CS27_West,	11103)
+ValuePair(Proj_Idaho_CS83_East,	11131)
+ValuePair(Proj_Idaho_CS83_Central,	11132)
+ValuePair(Proj_Idaho_CS83_West,	11133)
+ValuePair(Proj_Illinois_CS27_East,	11201)
+ValuePair(Proj_Illinois_CS27_West,	11202)
+ValuePair(Proj_Illinois_CS83_East,	11231)
+ValuePair(Proj_Illinois_CS83_West,	11232)
+ValuePair(Proj_Indiana_CS27_East,	11301)
+ValuePair(Proj_Indiana_CS27_West,	11302)
+ValuePair(Proj_Indiana_CS83_East,	11331)
+ValuePair(Proj_Indiana_CS83_West,	11332)
+ValuePair(Proj_Iowa_CS27_North,	11401)
+ValuePair(Proj_Iowa_CS27_South,	11402)
+ValuePair(Proj_Iowa_CS83_North,	11431)
+ValuePair(Proj_Iowa_CS83_South,	11432)
+ValuePair(Proj_Kansas_CS27_North,	11501)
+ValuePair(Proj_Kansas_CS27_South,	11502)
+ValuePair(Proj_Kansas_CS83_North,	11531)
+ValuePair(Proj_Kansas_CS83_South,	11532)
+ValuePair(Proj_Kentucky_CS27_North,	11601)
+ValuePair(Proj_Kentucky_CS27_South,	11602)
+ValuePair(Proj_Kentucky_CS83_North,	15303)
+ValuePair(Proj_Kentucky_CS83_South,	11632)
+ValuePair(Proj_Louisiana_CS27_North,	11701)
+ValuePair(Proj_Louisiana_CS27_South,	11702)
+ValuePair(Proj_Louisiana_CS83_North,	11731)
+ValuePair(Proj_Louisiana_CS83_South,	11732)
+ValuePair(Proj_Maine_CS27_East,	11801)
+ValuePair(Proj_Maine_CS27_West,	11802)
+ValuePair(Proj_Maine_CS83_East,	11831)
+ValuePair(Proj_Maine_CS83_West,	11832)
+ValuePair(Proj_Maryland_CS27,	11900)
+ValuePair(Proj_Maryland_CS83,	11930)
+ValuePair(Proj_Massachusetts_CS27_Mainland,	12001)
+ValuePair(Proj_Massachusetts_CS27_Island,	12002)
+ValuePair(Proj_Massachusetts_CS83_Mainland,	12031)
+ValuePair(Proj_Massachusetts_CS83_Island,	12032)
+ValuePair(Proj_Michigan_State_Plane_East,	12101)
+ValuePair(Proj_Michigan_State_Plane_Old_Central,	12102)
+ValuePair(Proj_Michigan_State_Plane_West,	12103)
+ValuePair(Proj_Michigan_CS27_North,	12111)
+ValuePair(Proj_Michigan_CS27_Central,	12112)
+ValuePair(Proj_Michigan_CS27_South,	12113)
+ValuePair(Proj_Michigan_CS83_North,	12141)
+ValuePair(Proj_Michigan_CS83_Central,	12142)
+ValuePair(Proj_Michigan_CS83_South,	12143)
+ValuePair(Proj_Minnesota_CS27_North,	12201)
+ValuePair(Proj_Minnesota_CS27_Central,	12202)
+ValuePair(Proj_Minnesota_CS27_South,	12203)
+ValuePair(Proj_Minnesota_CS83_North,	12231)
+ValuePair(Proj_Minnesota_CS83_Central,	12232)
+ValuePair(Proj_Minnesota_CS83_South,	12233)
+ValuePair(Proj_Mississippi_CS27_East,	12301)
+ValuePair(Proj_Mississippi_CS27_West,	12302)
+ValuePair(Proj_Mississippi_CS83_East,	12331)
+ValuePair(Proj_Mississippi_CS83_West,	12332)
+ValuePair(Proj_Missouri_CS27_East,	12401)
+ValuePair(Proj_Missouri_CS27_Central,	12402)
+ValuePair(Proj_Missouri_CS27_West,	12403)
+ValuePair(Proj_Missouri_CS83_East,	12431)
+ValuePair(Proj_Missouri_CS83_Central,	12432)
+ValuePair(Proj_Missouri_CS83_West,	12433)
+ValuePair(Proj_Montana_CS27_North,	12501)
+ValuePair(Proj_Montana_CS27_Central,	12502)
+ValuePair(Proj_Montana_CS27_South,	12503)
+ValuePair(Proj_Montana_CS83,	12530)
+ValuePair(Proj_Nebraska_CS27_North,	12601)
+ValuePair(Proj_Nebraska_CS27_South,	12602)
+ValuePair(Proj_Nebraska_CS83,	12630)
+ValuePair(Proj_Nevada_CS27_East,	12701)
+ValuePair(Proj_Nevada_CS27_Central,	12702)
+ValuePair(Proj_Nevada_CS27_West,	12703)
+ValuePair(Proj_Nevada_CS83_East,	12731)
+ValuePair(Proj_Nevada_CS83_Central,	12732)
+ValuePair(Proj_Nevada_CS83_West,	12733)
+ValuePair(Proj_New_Hampshire_CS27,	12800)
+ValuePair(Proj_New_Hampshire_CS83,	12830)
+ValuePair(Proj_New_Jersey_CS27,	12900)
+ValuePair(Proj_New_Jersey_CS83,	12930)
+ValuePair(Proj_New_Mexico_CS27_East,	13001)
+ValuePair(Proj_New_Mexico_CS27_Central,	13002)
+ValuePair(Proj_New_Mexico_CS27_West,	13003)
+ValuePair(Proj_New_Mexico_CS83_East,	13031)
+ValuePair(Proj_New_Mexico_CS83_Central,	13032)
+ValuePair(Proj_New_Mexico_CS83_West,	13033)
+ValuePair(Proj_New_York_CS27_East,	13101)
+ValuePair(Proj_New_York_CS27_Central,	13102)
+ValuePair(Proj_New_York_CS27_West,	13103)
+ValuePair(Proj_New_York_CS27_Long_Island,	13104)
+ValuePair(Proj_New_York_CS83_East,	13131)
+ValuePair(Proj_New_York_CS83_Central,	13132)
+ValuePair(Proj_New_York_CS83_West,	13133)
+ValuePair(Proj_New_York_CS83_Long_Island,	13134)
+ValuePair(Proj_North_Carolina_CS27,	13200)
+ValuePair(Proj_North_Carolina_CS83,	13230)
+ValuePair(Proj_North_Dakota_CS27_North,	13301)
+ValuePair(Proj_North_Dakota_CS27_South,	13302)
+ValuePair(Proj_North_Dakota_CS83_North,	13331)
+ValuePair(Proj_North_Dakota_CS83_South,	13332)
+ValuePair(Proj_Ohio_CS27_North,	13401)
+ValuePair(Proj_Ohio_CS27_South,	13402)
+ValuePair(Proj_Ohio_CS83_North,	13431)
+ValuePair(Proj_Ohio_CS83_South,	13432)
+ValuePair(Proj_Oklahoma_CS27_North,	13501)
+ValuePair(Proj_Oklahoma_CS27_South,	13502)
+ValuePair(Proj_Oklahoma_CS83_North,	13531)
+ValuePair(Proj_Oklahoma_CS83_South,	13532)
+ValuePair(Proj_Oregon_CS27_North,	13601)
+ValuePair(Proj_Oregon_CS27_South,	13602)
+ValuePair(Proj_Oregon_CS83_North,	13631)
+ValuePair(Proj_Oregon_CS83_South,	13632)
+ValuePair(Proj_Pennsylvania_CS27_North,	13701)
+ValuePair(Proj_Pennsylvania_CS27_South,	13702)
+ValuePair(Proj_Pennsylvania_CS83_North,	13731)
+ValuePair(Proj_Pennsylvania_CS83_South,	13732)
+ValuePair(Proj_Rhode_Island_CS27,	13800)
+ValuePair(Proj_Rhode_Island_CS83,	13830)
+ValuePair(Proj_South_Carolina_CS27_North,	13901)
+ValuePair(Proj_South_Carolina_CS27_South,	13902)
+ValuePair(Proj_South_Carolina_CS83,	13930)
+ValuePair(Proj_South_Dakota_CS27_North,	14001)
+ValuePair(Proj_South_Dakota_CS27_South,	14002)
+ValuePair(Proj_South_Dakota_CS83_North,	14031)
+ValuePair(Proj_South_Dakota_CS83_South,	14032)
+ValuePair(Proj_Tennessee_CS27,	15302)
+ValuePair(Proj_Tennessee_CS83,	14130)
+ValuePair(Proj_Texas_CS27_North,	14201)
+ValuePair(Proj_Texas_CS27_North_Central,	14202)
+ValuePair(Proj_Texas_CS27_Central,	14203)
+ValuePair(Proj_Texas_CS27_South_Central,	14204)
+ValuePair(Proj_Texas_CS27_South,	14205)
+ValuePair(Proj_Texas_CS83_North,	14231)
+ValuePair(Proj_Texas_CS83_North_Central,	14232)
+ValuePair(Proj_Texas_CS83_Central,	14233)
+ValuePair(Proj_Texas_CS83_South_Central,	14234)
+ValuePair(Proj_Texas_CS83_South,	14235)
+ValuePair(Proj_Utah_CS27_North,	14301)
+ValuePair(Proj_Utah_CS27_Central,	14302)
+ValuePair(Proj_Utah_CS27_South,	14303)
+ValuePair(Proj_Utah_CS83_North,	14331)
+ValuePair(Proj_Utah_CS83_Central,	14332)
+ValuePair(Proj_Utah_CS83_South,	14333)
+ValuePair(Proj_Vermont_CS27,	14400)
+ValuePair(Proj_Vermont_CS83,	14430)
+ValuePair(Proj_Virginia_CS27_North,	14501)
+ValuePair(Proj_Virginia_CS27_South,	14502)
+ValuePair(Proj_Virginia_CS83_North,	14531)
+ValuePair(Proj_Virginia_CS83_South,	14532)
+ValuePair(Proj_Washington_CS27_North,	14601)
+ValuePair(Proj_Washington_CS27_South,	14602)
+ValuePair(Proj_Washington_CS83_North,	14631)
+ValuePair(Proj_Washington_CS83_South,	14632)
+ValuePair(Proj_West_Virginia_CS27_North,	14701)
+ValuePair(Proj_West_Virginia_CS27_South,	14702)
+ValuePair(Proj_West_Virginia_CS83_North,	14731)
+ValuePair(Proj_West_Virginia_CS83_South,	14732)
+ValuePair(Proj_Wisconsin_CS27_North,	14801)
+ValuePair(Proj_Wisconsin_CS27_Central,	14802)
+ValuePair(Proj_Wisconsin_CS27_South,	14803)
+ValuePair(Proj_Wisconsin_CS83_North,	14831)
+ValuePair(Proj_Wisconsin_CS83_Central,	14832)
+ValuePair(Proj_Wisconsin_CS83_South,	14833)
+ValuePair(Proj_Wyoming_CS27_East,	14901)
+ValuePair(Proj_Wyoming_CS27_East_Central,	14902)
+ValuePair(Proj_Wyoming_CS27_West_Central,	14903)
+ValuePair(Proj_Wyoming_CS27_West,	14904)
+ValuePair(Proj_Wyoming_CS83_East,	14931)
+ValuePair(Proj_Wyoming_CS83_East_Central,	14932)
+ValuePair(Proj_Wyoming_CS83_West_Central,	14933)
+ValuePair(Proj_Wyoming_CS83_West,	14934)
+ValuePair(Proj_Alaska_CS27_1,	15001)
+ValuePair(Proj_Alaska_CS27_2,	15002)
+ValuePair(Proj_Alaska_CS27_3,	15003)
+ValuePair(Proj_Alaska_CS27_4,	15004)
+ValuePair(Proj_Alaska_CS27_5,	15005)
+ValuePair(Proj_Alaska_CS27_6,	15006)
+ValuePair(Proj_Alaska_CS27_7,	15007)
+ValuePair(Proj_Alaska_CS27_8,	15008)
+ValuePair(Proj_Alaska_CS27_9,	15009)
+ValuePair(Proj_Alaska_CS27_10,	15010)
+ValuePair(Proj_Alaska_CS83_1,	15031)
+ValuePair(Proj_Alaska_CS83_2,	15032)
+ValuePair(Proj_Alaska_CS83_3,	15033)
+ValuePair(Proj_Alaska_CS83_4,	15034)
+ValuePair(Proj_Alaska_CS83_5,	15035)
+ValuePair(Proj_Alaska_CS83_6,	15036)
+ValuePair(Proj_Alaska_CS83_7,	15037)
+ValuePair(Proj_Alaska_CS83_8,	15038)
+ValuePair(Proj_Alaska_CS83_9,	15039)
+ValuePair(Proj_Alaska_CS83_10,	15040)
+ValuePair(Proj_Hawaii_CS27_1,	15101)
+ValuePair(Proj_Hawaii_CS27_2,	15102)
+ValuePair(Proj_Hawaii_CS27_3,	15103)
+ValuePair(Proj_Hawaii_CS27_4,	15104)
+ValuePair(Proj_Hawaii_CS27_5,	15105)
+ValuePair(Proj_Hawaii_CS83_1,	15131)
+ValuePair(Proj_Hawaii_CS83_2,	15132)
+ValuePair(Proj_Hawaii_CS83_3,	15133)
+ValuePair(Proj_Hawaii_CS83_4,	15134)
+ValuePair(Proj_Hawaii_CS83_5,	15135)
+ValuePair(Proj_Puerto_Rico_CS27,	15201)
+ValuePair(Proj_St_Croix,	15202)
+ValuePair(Proj_Puerto_Rico_Virgin_Is,	15230)
+ValuePair(Proj_BLM_14N_feet,	15914)
+ValuePair(Proj_BLM_15N_feet,	15915)
+ValuePair(Proj_BLM_16N_feet,	15916)
+ValuePair(Proj_BLM_17N_feet,	15917)
+ValuePair(Proj_UTM_zone_1N,  16001)
+ValuePair(Proj_UTM_zone_2N,  16002)
+ValuePair(Proj_UTM_zone_3N,  16003)
+ValuePair(Proj_UTM_zone_4N,  16004)
+ValuePair(Proj_UTM_zone_5N,  16005)
+ValuePair(Proj_UTM_zone_6N,  16006)
+ValuePair(Proj_UTM_zone_7N,  16007)
+ValuePair(Proj_UTM_zone_8N,  16008)
+ValuePair(Proj_UTM_zone_9N,  16009)
+ValuePair(Proj_UTM_zone_10N, 16010)
+ValuePair(Proj_UTM_zone_11N, 16011)
+ValuePair(Proj_UTM_zone_12N, 16012)
+ValuePair(Proj_UTM_zone_13N, 16013)
+ValuePair(Proj_UTM_zone_14N, 16014)
+ValuePair(Proj_UTM_zone_15N, 16015)
+ValuePair(Proj_UTM_zone_16N, 16016)
+ValuePair(Proj_UTM_zone_17N, 16017)
+ValuePair(Proj_UTM_zone_18N, 16018)
+ValuePair(Proj_UTM_zone_19N, 16019)
+ValuePair(Proj_UTM_zone_20N, 16020)
+ValuePair(Proj_UTM_zone_21N, 16021)
+ValuePair(Proj_UTM_zone_22N, 16022)
+ValuePair(Proj_UTM_zone_23N, 16023)
+ValuePair(Proj_UTM_zone_24N, 16024)
+ValuePair(Proj_UTM_zone_25N, 16025)
+ValuePair(Proj_UTM_zone_26N, 16026)
+ValuePair(Proj_UTM_zone_27N, 16027)
+ValuePair(Proj_UTM_zone_28N, 16028)
+ValuePair(Proj_UTM_zone_29N, 16029)
+ValuePair(Proj_UTM_zone_30N, 16030)
+ValuePair(Proj_UTM_zone_31N, 16031)
+ValuePair(Proj_UTM_zone_32N, 16032)
+ValuePair(Proj_UTM_zone_33N, 16033)
+ValuePair(Proj_UTM_zone_34N, 16034)
+ValuePair(Proj_UTM_zone_35N, 16035)
+ValuePair(Proj_UTM_zone_36N, 16036)
+ValuePair(Proj_UTM_zone_37N, 16037)
+ValuePair(Proj_UTM_zone_38N, 16038)
+ValuePair(Proj_UTM_zone_39N, 16039)
+ValuePair(Proj_UTM_zone_40N, 16040)
+ValuePair(Proj_UTM_zone_41N, 16041)
+ValuePair(Proj_UTM_zone_42N, 16042)
+ValuePair(Proj_UTM_zone_43N, 16043)
+ValuePair(Proj_UTM_zone_44N, 16044)
+ValuePair(Proj_UTM_zone_45N, 16045)
+ValuePair(Proj_UTM_zone_46N, 16046)
+ValuePair(Proj_UTM_zone_47N, 16047)
+ValuePair(Proj_UTM_zone_48N, 16048)
+ValuePair(Proj_UTM_zone_49N, 16049)
+ValuePair(Proj_UTM_zone_50N, 16050)
+ValuePair(Proj_UTM_zone_51N, 16051)
+ValuePair(Proj_UTM_zone_52N, 16052)
+ValuePair(Proj_UTM_zone_53N, 16053)
+ValuePair(Proj_UTM_zone_54N, 16054)
+ValuePair(Proj_UTM_zone_55N, 16055)
+ValuePair(Proj_UTM_zone_56N, 16056)
+ValuePair(Proj_UTM_zone_57N, 16057)
+ValuePair(Proj_UTM_zone_58N, 16058)
+ValuePair(Proj_UTM_zone_59N, 16059)
+ValuePair(Proj_UTM_zone_60N, 16060)
+ValuePair(Proj_UTM_zone_1S,  16101)
+ValuePair(Proj_UTM_zone_2S,  16102)
+ValuePair(Proj_UTM_zone_3S,  16103)
+ValuePair(Proj_UTM_zone_4S,  16104)
+ValuePair(Proj_UTM_zone_5S,  16105)
+ValuePair(Proj_UTM_zone_6S,  16106)
+ValuePair(Proj_UTM_zone_7S,  16107)
+ValuePair(Proj_UTM_zone_8S,  16108)
+ValuePair(Proj_UTM_zone_9S,  16109)
+ValuePair(Proj_UTM_zone_10S, 16110)
+ValuePair(Proj_UTM_zone_11S, 16111)
+ValuePair(Proj_UTM_zone_12S, 16112)
+ValuePair(Proj_UTM_zone_13S, 16113)
+ValuePair(Proj_UTM_zone_14S, 16114)
+ValuePair(Proj_UTM_zone_15S, 16115)
+ValuePair(Proj_UTM_zone_16S, 16116)
+ValuePair(Proj_UTM_zone_17S, 16117)
+ValuePair(Proj_UTM_zone_18S, 16118)
+ValuePair(Proj_UTM_zone_19S, 16119)
+ValuePair(Proj_UTM_zone_20S, 16120)
+ValuePair(Proj_UTM_zone_21S, 16121)
+ValuePair(Proj_UTM_zone_22S, 16122)
+ValuePair(Proj_UTM_zone_23S, 16123)
+ValuePair(Proj_UTM_zone_24S, 16124)
+ValuePair(Proj_UTM_zone_25S, 16125)
+ValuePair(Proj_UTM_zone_26S, 16126)
+ValuePair(Proj_UTM_zone_27S, 16127)
+ValuePair(Proj_UTM_zone_28S, 16128)
+ValuePair(Proj_UTM_zone_29S, 16129)
+ValuePair(Proj_UTM_zone_30S, 16130)
+ValuePair(Proj_UTM_zone_31S, 16131)
+ValuePair(Proj_UTM_zone_32S, 16132)
+ValuePair(Proj_UTM_zone_33S, 16133)
+ValuePair(Proj_UTM_zone_34S, 16134)
+ValuePair(Proj_UTM_zone_35S, 16135)
+ValuePair(Proj_UTM_zone_36S, 16136)
+ValuePair(Proj_UTM_zone_37S, 16137)
+ValuePair(Proj_UTM_zone_38S, 16138)
+ValuePair(Proj_UTM_zone_39S, 16139)
+ValuePair(Proj_UTM_zone_40S, 16140)
+ValuePair(Proj_UTM_zone_41S, 16141)
+ValuePair(Proj_UTM_zone_42S, 16142)
+ValuePair(Proj_UTM_zone_43S, 16143)
+ValuePair(Proj_UTM_zone_44S, 16144)
+ValuePair(Proj_UTM_zone_45S, 16145)
+ValuePair(Proj_UTM_zone_46S, 16146)
+ValuePair(Proj_UTM_zone_47S, 16147)
+ValuePair(Proj_UTM_zone_48S, 16148)
+ValuePair(Proj_UTM_zone_49S, 16149)
+ValuePair(Proj_UTM_zone_50S, 16150)
+ValuePair(Proj_UTM_zone_51S, 16151)
+ValuePair(Proj_UTM_zone_52S, 16152)
+ValuePair(Proj_UTM_zone_53S, 16153)
+ValuePair(Proj_UTM_zone_54S, 16154)
+ValuePair(Proj_UTM_zone_55S, 16155)
+ValuePair(Proj_UTM_zone_56S, 16156)
+ValuePair(Proj_UTM_zone_57S, 16157)
+ValuePair(Proj_UTM_zone_58S, 16158)
+ValuePair(Proj_UTM_zone_59S, 16159)
+ValuePair(Proj_UTM_zone_60S, 16160)
+ValuePair(Proj_Gauss_Kruger_zone_0, 16200)
+ValuePair(Proj_Gauss_Kruger_zone_1, 16201)
+ValuePair(Proj_Gauss_Kruger_zone_2, 16202)
+ValuePair(Proj_Gauss_Kruger_zone_3, 16203)
+ValuePair(Proj_Gauss_Kruger_zone_4, 16204)
+ValuePair(Proj_Gauss_Kruger_zone_5, 16205)
+ValuePair(Proj_Map_Grid_of_Australia_48,	17348)
+ValuePair(Proj_Map_Grid_of_Australia_49,	17349)
+ValuePair(Proj_Map_Grid_of_Australia_50,	17350)
+ValuePair(Proj_Map_Grid_of_Australia_51,	17351)
+ValuePair(Proj_Map_Grid_of_Australia_52,	17352)
+ValuePair(Proj_Map_Grid_of_Australia_53,	17353)
+ValuePair(Proj_Map_Grid_of_Australia_54,	17354)
+ValuePair(Proj_Map_Grid_of_Australia_55,	17355)
+ValuePair(Proj_Map_Grid_of_Australia_56,	17356)
+ValuePair(Proj_Map_Grid_of_Australia_57,	17357)
+ValuePair(Proj_Map_Grid_of_Australia_58,	17358)
+ValuePair(Proj_Australian_Map_Grid_48,	17448)
+ValuePair(Proj_Australian_Map_Grid_49,	17449)
+ValuePair(Proj_Australian_Map_Grid_50,	17450)
+ValuePair(Proj_Australian_Map_Grid_51,	17451)
+ValuePair(Proj_Australian_Map_Grid_52,	17452)
+ValuePair(Proj_Australian_Map_Grid_53,	17453)
+ValuePair(Proj_Australian_Map_Grid_54,	17454)
+ValuePair(Proj_Australian_Map_Grid_55,	17455)
+ValuePair(Proj_Australian_Map_Grid_56,	17456)
+ValuePair(Proj_Australian_Map_Grid_57,	17457)
+ValuePair(Proj_Australian_Map_Grid_58,	17458)
+ValuePair(Proj_Argentina_1,	18031)
+ValuePair(Proj_Argentina_2,	18032)
+ValuePair(Proj_Argentina_3,	18033)
+ValuePair(Proj_Argentina_4,	18034)
+ValuePair(Proj_Argentina_5,	18035)
+ValuePair(Proj_Argentina_6,	18036)
+ValuePair(Proj_Argentina_7,	18037)
+ValuePair(Proj_Colombia_3W,	18051)
+ValuePair(Proj_Colombia_Bogota,	18052)
+ValuePair(Proj_Colombia_3E,	18053)
+ValuePair(Proj_Colombia_6E,	18054)
+ValuePair(Proj_Egypt_Red_Belt,	18072)
+ValuePair(Proj_Egypt_Purple_Belt,	18073)
+ValuePair(Proj_Extended_Purple_Belt,	18074)
+ValuePair(Proj_New_Zealand_North_Island_Nat_Grid,	18141)
+ValuePair(Proj_New_Zealand_South_Island_Nat_Grid,	18142)
+ValuePair(Proj_Bahrain_Grid,	19900)
+ValuePair(Proj_Netherlands_E_Indies_Equatorial,	19905)
+ValuePair(Proj_RSO_Borneo,	19912)
+/* end of list */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_units.inc
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_units.inc	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_units.inc	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,35 @@
+/*
+ * Rev. 0.2 EPSG/POSC Units Database.
+ */
+ 
+#ifdef INCLUDE_OLD_CODES
+#include geo_units.inc
+#endif /* OLD Codes */
+
+ValuePair(Linear_Meter,	9001)
+ValuePair(Linear_Foot,	9002)
+ValuePair(Linear_Foot_US_Survey,	9003)
+ValuePair(Linear_Foot_Modified_American,	9004)
+ValuePair(Linear_Foot_Clarke,	9005)
+ValuePair(Linear_Foot_Indian,	9006)
+ValuePair(Linear_Link,	9007)
+ValuePair(Linear_Link_Benoit,	9008)
+ValuePair(Linear_Link_Sears,	9009)
+ValuePair(Linear_Chain_Benoit,	9010)
+ValuePair(Linear_Chain_Sears,	9011)
+ValuePair(Linear_Yard_Sears,	9012)
+ValuePair(Linear_Yard_Indian,	9013)
+ValuePair(Linear_Fathom,	9014)
+ValuePair(Linear_Mile_International_Nautical,	9015)
+/*
+ *  Angular Units
+ */
+ValuePair(Angular_Radian,	9101)
+ValuePair(Angular_Degree,	9102)
+ValuePair(Angular_Arc_Minute,	9103)
+ValuePair(Angular_Arc_Second,	9104)
+ValuePair(Angular_Grad,	9105)
+ValuePair(Angular_Gon,	9106)
+ValuePair(Angular_DMS,	9107)
+ValuePair(Angular_DMS_Hemisphere,	9108)
+/* end of list */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_vertcs.inc
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_vertcs.inc	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/epsg_vertcs.inc	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,46 @@
+/*
+ *  EPSG/POSC Ellipsoid-referenced Vertical CS
+ *   Note: these should correspond exactly with the Ellipsoid database.
+ */
+ValuePair(VertCS_Airy_1830_ellipsoid,	5001)
+ValuePair(VertCS_Airy_Modified_1849_ellipsoid,	5002)
+ValuePair(VertCS_ANS_ellipsoid,	5003)
+ValuePair(VertCS_Bessel_1841_ellipsoid,	5004)
+ValuePair(VertCS_Bessel_Modified_ellipsoid,	5005)
+ValuePair(VertCS_Bessel_Namibia_ellipsoid,	5006)
+ValuePair(VertCS_Clarke_1858_ellipsoid,	5007)
+ValuePair(VertCS_Clarke_1866_ellipsoid,	5008)
+ValuePair(VertCS_Clarke_1880_Benoit_ellipsoid,	5010)
+ValuePair(VertCS_Clarke_1880_IGN_ellipsoid,	5011)
+ValuePair(VertCS_Clarke_1880_RGS_ellipsoid,	5012)
+ValuePair(VertCS_Clarke_1880_Arc_ellipsoid,	5013)
+ValuePair(VertCS_Clarke_1880_SGA_1922_ellipsoid,	5014)
+ValuePair(VertCS_Everest_1830_1937_Adjustment_ellipsoid,	5015)
+ValuePair(VertCS_Everest_1830_1967_Definition_ellipsoid,	5016)
+ValuePair(VertCS_Everest_1830_1975_Definition_ellipsoid,	5017)
+ValuePair(VertCS_Everest_1830_Modified_ellipsoid,	5018)
+ValuePair(VertCS_GRS_1980_ellipsoid,	5019)
+ValuePair(VertCS_Helmert_1906_ellipsoid,	5020)
+ValuePair(VertCS_INS_ellipsoid,	5021)
+ValuePair(VertCS_International_1924_ellipsoid,	5022)
+ValuePair(VertCS_International_1967_ellipsoid,	5023)
+ValuePair(VertCS_Krassowsky_1940_ellipsoid,	5024)
+ValuePair(VertCS_NWL_9D_ellipsoid,	5025)
+ValuePair(VertCS_NWL_10D_ellipsoid,	5026)
+ValuePair(VertCS_Plessis_1817_ellipsoid,	5027)
+ValuePair(VertCS_Struve_1860_ellipsoid,	5028)
+ValuePair(VertCS_War_Office_ellipsoid,	5029)
+ValuePair(VertCS_WGS_84_ellipsoid,	5030)
+ValuePair(VertCS_GEM_10C_ellipsoid,	5031)
+ValuePair(VertCS_OSU86F_ellipsoid,	5032)
+ValuePair(VertCS_OSU91A_ellipsoid,	5033)
+/*
+ *  Other established Vertical CS
+ */
+ValuePair(VertCS_Newlyn,	5101)
+ValuePair(VertCS_North_American_Vertical_Datum_1929,	5102)
+ValuePair(VertCS_North_American_Vertical_Datum_1988,	5103)
+ValuePair(VertCS_Yellow_Sea_1956,	5104)
+ValuePair(VertCS_Baltic_Sea,	5105)
+ValuePair(VertCS_Caspian_Sea,	5106)
+/* end of list */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_config.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_config.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_config.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,24 @@
+/* geo_config.h.  Generated automatically by configure.  */
+#ifndef GEO_CONFIG_H
+#define GEO_CONFIG_H
+
+/* Define if you have the ANSI C header files.  */
+#define STDC_HEADERS 1
+
+/* Define if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define if you have the <stdlib.h> header file.  */
+#define HAVE_STDLIB_H 1
+
+/* Define if you have the <string.h> header file.  */
+#define HAVE_STRING_H 1
+
+/* Define if you have the <strings.h> header file.  */
+#define HAVE_STRINGS_H 1
+
+/* Build as DLL */
+#define BUILD_AS_DLL      1
+
+#endif /* ndef GEO_CONFIG_H */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_ctrans.inc
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_ctrans.inc	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_ctrans.inc	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,55 @@
+/* GeoTIFF Coordinate Transformations Database */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+/*
+ *  Revised 12 Jul 1995   NDR -- changed South Oriented to a code 
+ *  Revised 28 Sep 1995   NDR -- Added Rev. 1.0 aliases. 
+ */
+
+ValuePair(CT_TransverseMercator,	1)
+ValuePair(CT_TransvMercator_Modified_Alaska, 2)
+ValuePair(CT_ObliqueMercator,	3)
+ValuePair(CT_ObliqueMercator_Laborde,	4)
+ValuePair(CT_ObliqueMercator_Rosenmund,	5)
+ValuePair(CT_ObliqueMercator_Spherical,	6)   /* not advisable */
+ValuePair(CT_Mercator,	7)
+ValuePair(CT_LambertConfConic_2SP,	8)
+ValuePair(CT_LambertConfConic,CT_LambertConfConic_2SP)         /* Alias */
+ValuePair(CT_LambertConfConic_1SP,	9)
+ValuePair(CT_LambertConfConic_Helmert,CT_LambertConfConic_1SP) /* alias */
+ValuePair(CT_LambertAzimEqualArea,	10)
+ValuePair(CT_AlbersEqualArea,	11)
+ValuePair(CT_AzimuthalEquidistant,	12)
+ValuePair(CT_EquidistantConic,	13)
+ValuePair(CT_Stereographic,	14)
+ValuePair(CT_PolarStereographic,	15)
+ValuePair(CT_ObliqueStereographic,	16)   /* not advisable */
+ValuePair(CT_Equirectangular,	17)
+ValuePair(CT_CassiniSoldner,	18)
+ValuePair(CT_Gnomonic,	19)
+ValuePair(CT_MillerCylindrical,	20)
+ValuePair(CT_Orthographic,	21)
+ValuePair(CT_Polyconic,	22)
+ValuePair(CT_Robinson,	23)
+ValuePair(CT_Sinusoidal,	24)
+ValuePair(CT_VanDerGrinten,	25)
+ValuePair(CT_NewZealandMapGrid,	26)
+/* Added for 1.0 */
+ValuePair(CT_TransvMercator_SouthOrientated, 27)
+
+
+/* Aliases */
+
+ValuePair(CT_SouthOrientedGaussConformal,CT_TransvMercator_SouthOrientated)
+ValuePair(CT_AlaskaConformal,	CT_TransvMercator_Modified_Alaska)
+ValuePair(CT_TransvEquidistCylindrical,	CT_CassiniSoldner)
+ValuePair(CT_ObliqueMercator_Hotine,	CT_ObliqueMercator)
+ValuePair(CT_SwissObliqueCylindrical,	CT_ObliqueMercator_Rosenmund)
+ValuePair(CT_GaussBoaga,	CT_TransverseMercator)
+ValuePair(CT_GaussKruger,	CT_TransverseMercator)
+ValuePair(CT_TransvMercator_SouthOriented, CT_TransvMercator_SouthOrientated)
+
+

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_keyp.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_keyp.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_keyp.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,98 @@
+/**********************************************************************
+ *
+ *  geo_keyp.h - private interface for GeoTIFF geokey tag parsing
+ *
+ *     Written by: Niles D. Ritter
+ *
+ **********************************************************************/
+
+#ifndef __geo_keyp_h_
+#define __geo_keyp_h_
+
+#include <stdlib.h> /* for size_t */
+
+/*
+ * This structure contains the internal program
+ * representation of the key entry.
+ */
+struct GeoKey {
+	int       gk_key;    /* GeoKey ID        */
+	size_t    gk_size;   /* data byte size   */
+	tagtype_t gk_type;   /* TIFF data type   */
+	long      gk_count;  /* number of values */
+	char*     gk_data;   /* pointer to data, or value */
+};
+typedef struct GeoKey GeoKey;
+
+/*
+ *  This structure represents the file-organization of
+ *  the key entry. Note that it assumes that short entries
+ *  are aligned along 2-byte boundaries.
+ */
+struct KeyEntry {
+	pinfo_t ent_key;        /* GeoKey ID            */
+	pinfo_t ent_location;   /* TIFF Tag ID or 0     */
+	pinfo_t ent_count;      /* GeoKey value count   */
+	pinfo_t ent_val_offset; /* value or tag offset  */
+};
+typedef struct KeyEntry KeyEntry;
+
+/*
+ * This is the header of the CoordSystemInfoTag. The 'Version'
+ *  will only change if the CoorSystemInfoTag structure changes;
+ *  The Major Revision will be incremented whenever a new set of
+ *  Keys is added or changed, while the Minor revision will be
+ *  incremented when only the set of Key-values is increased.
+ */
+struct KeyHeader{
+	pinfo_t hdr_version;      /* GeoTIFF Version          */
+	pinfo_t hdr_rev_major;    /* GeoKey Major Revision #  */
+	pinfo_t hdr_rev_minor;    /* GeoKey Minor Revision #  */
+	pinfo_t hdr_num_keys;     /* Number of GeoKeys        */
+};
+typedef struct KeyHeader KeyHeader;
+
+/*
+ * This structure holds temporary data while reading or writing
+ *  the tags.
+ */
+struct TempKeyData {
+    char   *tk_asciiParams;
+    int     tk_asciiParamsLength;
+    int     tk_asciiParamsOffset;
+};
+typedef struct TempKeyData TempKeyData;
+
+
+struct gtiff {
+   tiff_t*    gt_tif;      /* TIFF file descriptor  */
+   TIFFMethod gt_methods;  /* TIFF i/o methods      */
+   int        gt_flags;    /* file flags            */
+   
+   pinfo_t    gt_version;  /* GeoTIFF Version       */
+   pinfo_t    gt_rev_major;/* GeoKey Key Revision   */
+   pinfo_t    gt_rev_minor;/* GeoKey Code Revision  */
+   
+   int        gt_num_keys; /* number of keys        */
+   GeoKey*    gt_keys;     /* array of keys         */
+   int*       gt_keyindex; /* index of a key, if set*/
+   int        gt_keymin;   /* smallest key set      */
+   int        gt_keymax;   /* largest key set       */
+   
+   pinfo_t*   gt_short;    /* array of SHORT vals   */
+   double*    gt_double;   /* array of DOUBLE vals  */
+   int        gt_nshorts;  /* number of SHORT vals  */
+   int        gt_ndoubles; /* number of DOUBLE vals */
+};  
+
+typedef enum {
+	FLAG_FILE_OPEN=1,
+	FLAG_FILE_MODIFIED=2
+} gtiff_flags;
+
+#define MAX_KEYINDEX 65535   /* largest possible key    */
+#define MAX_KEYS 100         /* maximum keys in a file  */
+#define MAX_VALUES 1000      /* maximum values in a tag */
+
+#endif /* __geo_keyp_h_ */
+

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_normalize.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_normalize.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_normalize.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,230 @@
+/******************************************************************************
+ * $Id: geo_normalize.h,v 1.10 2003/01/15 04:39:16 warmerda Exp $
+ *
+ * Project:  libgeotiff
+ * Purpose:  Include file related to geo_normalize.c containing Code to
+ *           normalize PCS and other composite codes in a GeoTIFF file.
+ * Author:   Frank Warmerdam, warmerda at home.com
+ *
+ ******************************************************************************
+ * Copyright (c) 1999, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ *
+ * $Log: geo_normalize.h,v $
+ * Revision 1.10  2003/01/15 04:39:16  warmerda
+ * Added GTIFDeaccessCSV
+ *
+ * Revision 1.9  2003/01/15 03:37:40  warmerda
+ * added GTIFFreeMemory()
+ *
+ * Revision 1.8  2002/11/28 22:27:42  warmerda
+ * preliminary upgrade to EPSG 6.2.2 tables
+ *
+ * Revision 1.7  1999/09/17 00:55:26  warmerda
+ * added GTIFGetUOMAngleInfo(), and UOMAngle in GTIFDefn
+ *
+ * Revision 1.6  1999/05/04 03:13:42  warmerda
+ * Added prototype
+ *
+ * Revision 1.5  1999/04/29 23:02:55  warmerda
+ * added docs, and MapSys related stuff
+ *
+ * Revision 1.4  1999/03/18 21:35:19  geotiff
+ * Added PROJ.4 related stuff
+ *
+ * Revision 1.3  1999/03/17 20:44:04  geotiff
+ * added CPL_DLL related support
+ *
+ * Revision 1.2  1999/03/10 18:24:06  geotiff
+ * corrected to use int'
+ *
+ */
+
+#ifndef GEO_NORMALIZE_H_INCLUDED
+#define GEO_NORMALIZE_H_INCLUDED
+
+#include <stdio.h>
+#include "geotiff.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file geo_normalize.h
+ *
+ * Include file for extended projection definition normalization api.
+ */
+    
+#define MAX_GTIF_PROJPARMS 	10
+
+/**
+ * Holds a definition of a coordinate system in normalized form.
+ */
+
+typedef struct {
+    /** From GTModelTypeGeoKey tag.  Can have the values ModelTypeGeographic
+        or ModelTypeProjected. */
+    short	Model;
+
+    /** From ProjectedCSTypeGeoKey tag.  For example PCS_NAD27_UTM_zone_3N.*/
+    short	PCS;
+
+    /** From GeographicTypeGeoKey tag.  For example GCS_WGS_84 or
+        GCS_Voirol_1875_Paris.  Includes datum and prime meridian value. */
+    short	GCS;	      
+
+    /** From ProjLinearUnitsGeoKey.  For example Linear_Meter. */
+    short	UOMLength;
+
+    /** One UOMLength = UOMLengthInMeters meters. */
+    double	UOMLengthInMeters;
+
+    /** The angular units of the GCS. */
+    short       UOMAngle;
+
+    /** One UOMAngle = UOMLengthInDegrees degrees. */
+    double      UOMAngleInDegrees;
+    
+    /** Datum from GeogGeodeticDatumGeoKey tag. For example Datum_WGS84 */
+    short	Datum;
+
+    /** Prime meridian from GeogPrimeMeridianGeoKey.  For example PM_Greenwich
+        or PM_Paris. */
+    short	PM;
+
+    /** Decimal degrees of longitude between this prime meridian and
+        Greenwich.  Prime meridians to the west of Greenwich are negative. */
+    double	PMLongToGreenwich;
+
+    /** Ellipsoid identifier from GeogELlipsoidGeoKey.  For example
+        Ellipse_Clarke_1866. */
+    short	Ellipsoid;
+
+    /** The length of the semi major ellipse axis in meters. */
+    double	SemiMajor;
+
+    /** The length of the semi minor ellipse axis in meters. */
+    double	SemiMinor;
+
+    /** Projection id from ProjectionGeoKey.  For example Proj_UTM_11S. */
+    short	ProjCode;
+
+    /** EPSG identifier for underlying projection method.  From the EPSG
+        TRF_METHOD table.  */
+    short	Projection;
+
+    /** GeoTIFF identifier for underlying projection method.  While some of
+      these values have corresponding vlaues in EPSG (Projection field),
+      others do not.  For example CT_TransverseMercator. */
+    short	CTProjection;   
+
+    /** Number of projection parameters in ProjParm and ProjParmId. */
+    int		nParms;
+
+    /** Projection parameter value.  The identify of this parameter
+        is established from the corresponding entry in ProjParmId.  The
+        value will be measured in meters, or decimal degrees if it is a
+        linear or angular measure. */
+    double	ProjParm[MAX_GTIF_PROJPARMS];
+
+    /** Projection parameter identifier.  For example ProjFalseEastingGeoKey.
+        The value will be 0 for unused table entries. */
+    int		ProjParmId[MAX_GTIF_PROJPARMS]; /* geokey identifier,
+                                                   eg. ProjFalseEastingGeoKey*/
+
+    /** Special zone map system code (MapSys_UTM_South, MapSys_UTM_North,
+        MapSys_State_Plane or KvUserDefined if none apply. */
+    int		MapSys;
+
+    /** UTM, or State Plane Zone number, zero if not known. */
+    int		Zone;
+
+} GTIFDefn;
+
+int CPL_DLL GTIFGetPCSInfo( int nPCSCode, char **ppszEPSGName,
+                            short *pnProjOp, 
+                            short *pnUOMLengthCode, short *pnGeogCS );
+int CPL_DLL GTIFGetProjTRFInfo( int nProjTRFCode,
+                                char ** ppszProjTRFName,
+                                short * pnProjMethod,
+                                double * padfProjParms );
+int CPL_DLL GTIFGetGCSInfo( int nGCSCode, char **ppszName,
+                            short *pnDatum, short *pnPM, short *pnUOMAngle );
+int CPL_DLL GTIFGetDatumInfo( int nDatumCode, char **ppszName,
+                              short * pnEllipsoid );
+int CPL_DLL GTIFGetEllipsoidInfo( int nEllipsoid, char ** ppszName,
+                                  double * pdfSemiMajor,
+                                  double * pdfSemiMinor );
+int CPL_DLL GTIFGetPMInfo( int nPM, char **ppszName,
+                           double * pdfLongToGreenwich );
+
+double CPL_DLL GTIFAngleStringToDD( const char *pszAngle, int nUOMAngle );
+int CPL_DLL GTIFGetUOMLengthInfo( int nUOMLengthCode,
+                                  char **ppszUOMName,
+                                  double * pdfInMeters );
+int CPL_DLL GTIFGetUOMAngleInfo( int nUOMAngleCode,
+                                 char **ppszUOMName,
+                                 double * pdfInDegrees );
+
+/* this should be used to free strings returned by GTIFGet... funcs */
+void CPL_DLL GTIFFreeMemory( char * );
+void CPL_DLL GTIFDeaccessCSV();
+
+int CPL_DLL GTIFGetDefn( GTIF *psGTIF, GTIFDefn * psDefn );
+void CPL_DLL GTIFPrintDefn( GTIFDefn *, FILE * );
+void CPL_DLL GTIFFreeDefn( GTIF * );
+
+void CPL_DLL SetCSVFilenameHook( const char *(*CSVFileOverride)(const char *) );
+
+const char CPL_DLL *GTIFDecToDMS( double, const char *, int );
+
+/*
+ * These are useful for recognising UTM and State Plane, with or without
+ * CSV files being found.
+ */
+
+#define MapSys_UTM_North	-9001
+#define MapSys_UTM_South	-9002
+#define MapSys_State_Plane_27	-9003
+#define MapSys_State_Plane_83	-9004
+
+int CPL_DLL   GTIFMapSysToPCS( int MapSys, int Datum, int nZone );
+int CPL_DLL   GTIFMapSysToProj( int MapSys, int nZone );
+int CPL_DLL   GTIFPCSToMapSys( int PCSCode, int * pDatum, int * pZone );
+int CPL_DLL   GTIFProjToMapSys( int ProjCode, int * pZone );
+
+/*
+ * These are only useful if using libgeotiff with libproj (PROJ.4+).
+ */
+char CPL_DLL *GTIFGetProj4Defn( GTIFDefn * );
+int  CPL_DLL  GTIFProj4ToLatLong( GTIFDefn *, int, double *, double * );
+int  CPL_DLL  GTIFProj4FromLatLong( GTIFDefn *, int, double *, double * );
+
+#if defined(HAVE_LIBPROJ) && defined(HAVE_PROJECTS_H)
+#  define HAVE_GTIFPROJ4
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+    
+#endif /* ndef GEO_NORMALIZE_H_INCLUDED */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_tiffp.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_tiffp.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/geo_tiffp.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,113 @@
+/**********************************************************************
+ *
+ *  geo_tiffp.h - Private interface for TIFF tag parsing.
+ *
+ *   Written by: Niles D. Ritter
+ *
+ *   This interface file encapsulates the interface to external TIFF
+ *   file-io routines and definitions. The current configuration
+ *   assumes that the "libtiff" module is used, but if you have your
+ *   own TIFF reader, you may replace the definitions with your own
+ *   here, and replace the implementations in geo_tiffp.c. No other
+ *   modules have any explicit dependence on external TIFF modules.
+ *
+ *  Revision History;
+ *
+ *    20 June, 1995      Niles D. Ritter         New
+ *    6 July,  1995      Niles D. Ritter         Fix prototypes
+ *
+ **********************************************************************/
+
+#ifndef __geo_tiffp_h_
+#define __geo_tiffp_h_
+
+/**********************************************************************
+ *
+ *                        Private includes
+ *
+ *   If you are not using libtiff and XTIFF, replace this include file
+ *    with the appropriate one for your own TIFF parsing routines.
+ *
+ *   Revision History
+ * 
+ *      19 September 1995   ndr    Demoted Intergraph trans matrix.
+ *
+ **********************************************************************/
+
+#include "geotiff.h"
+#include "xtiffio.h"
+
+/*
+ * dblparam_t is the type that a double precision
+ * floating point value will have on the parameter
+ * stack (when coerced by the compiler). You shouldn't
+ * have to change this.
+ */
+#ifdef applec
+typedef extended dblparam_t;
+#else
+typedef double dblparam_t;
+#endif
+
+
+/**********************************************************************
+ *
+ *                        Private defines
+ *
+ *   If you are not using "libtiff"/LIBXTIFF, replace these definitions
+ *   with the appropriate definitions to access the geo-tags
+ *
+ **********************************************************************/
+ 
+typedef unsigned short pinfo_t;    /* SHORT ProjectionInfo tag type */
+typedef TIFF    tiff_t;            /* TIFF file descriptor          */
+typedef tdata_t  gdata_t;          /* pointer to data */
+typedef tsize_t  gsize_t;          /* data allocation size */
+ 
+#define GTIFF_GEOKEYDIRECTORY   TIFFTAG_GEOKEYDIRECTORY /* from xtiffio.h */
+#define GTIFF_DOUBLEPARAMS      TIFFTAG_GEODOUBLEPARAMS
+#define GTIFF_ASCIIPARAMS       TIFFTAG_GEOASCIIPARAMS
+#define GTIFF_PIXELSCALE        TIFFTAG_GEOPIXELSCALE
+#define GTIFF_TRANSMATRIX       TIFFTAG_GEOTRANSMATRIX
+#define GTIFF_INTERGRAPH_MATRIX TIFFTAG_INTERGRAPH_MATRIX
+#define GTIFF_TIEPOINTS         TIFFTAG_GEOTIEPOINTS
+#define GTIFF_LOCAL          0
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*
+ * Method function pointer types
+ */
+typedef int        (*GTGetFunction) (tiff_t *tif, pinfo_t tag, int *count, void *value );
+typedef int        (*GTSetFunction) (tiff_t *tif, pinfo_t tag, int  count, void *value );
+typedef tagtype_t  (*GTTypeFunction) (tiff_t *tif, pinfo_t tag);
+typedef struct     _TIFFMethod {
+	GTGetFunction get;
+	GTSetFunction set;
+	GTTypeFunction type;
+} TIFFMethod;
+
+/**********************************************************************
+ *
+ *               Protected Function Declarations  
+ *
+ *   These routines are exposed implementations, and should not
+ *   be used by external GEOTIFF client programs.
+ *
+ **********************************************************************/
+
+extern gsize_t _gtiff_size[]; /* TIFF data sizes */
+extern void _GTIFSetDefaultTIFF(TIFFMethod *method);
+extern gdata_t _GTIFcalloc(gsize_t);
+extern gdata_t _GTIFrealloc(gdata_t,gsize_t);
+extern void _GTIFFree(gdata_t data);
+extern void _GTIFmemcpy(gdata_t out,gdata_t in,gsize_t size);
+
+#if defined(__cplusplus)
+} 
+#endif
+
+
+#endif /* __geo_tiffp_h_ */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/geokeys.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/geokeys.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/geokeys.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,54 @@
+/**********************************************************************
+ *
+ *  geokeys.h - Public registry for valid GEOTIFF GeoKeys.
+ *
+ *   Written By: Niles D. Ritter
+ *
+ *  Revision History:
+ *
+ *     Rev.#  Author  M/D/Y Date     Key Changes/Additions
+ *     -----  ------  ----------  -------------------------------------
+ *       0      ndr    06/10/95      Inital Beta Release
+ *       1      ndr    09/18/95      Final 1.0 Release
+ *
+ **********************************************************************/
+
+#ifndef __geokeys_h_
+#define __geokeys_h_
+
+/* The GvCurrentRevision number should be incremented whenever a 
+ * new set of Keys are defined or modified in "geokeys.inc", and comments 
+ * added to the "Revision History" section above. If only code
+ * _values_ are augmented, the "GvCurrentMinorRev" number should
+ * be incremented instead (see "geovalues.h"). Whenever the 
+ * GvCurrentRevision is incremented, the GvCurrentMinorRev should
+ * be reset to zero.
+ *
+ *
+ * The Section Numbers below refer to the GeoTIFF Spec sections
+ * in which these values are documented.
+ *
+ */
+#define GvCurrentRevision  1  /* Final 1.0 Release */
+
+#ifdef ValuePair
+#  undef ValuePair
+#endif
+#define ValuePair(name,value)    name = value,
+
+typedef enum {
+   BaseGeoKey   =  1024,               /* First valid code */
+
+#  include "geokeys.inc"         /* geokey database */
+
+   ReservedEndGeoKey  =  32767,
+   
+   /* Key space available for Private or internal use */
+   PrivateBaseGeoKey = 32768,    /* Consistent with TIFF Private tags */
+   PrivateEndGeoKey  = 65535,    
+   
+   EndGeoKey = 65535             /* Largest Possible GeoKey ID */
+} geokey_t;
+
+
+#endif /* __geokeys_h_ */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/geokeys.inc
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/geokeys.inc	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/geokeys.inc	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,76 @@
+/* GeoTIFF GeoKey Database */
+
+/* Note: Any changes/additions to this database require */
+/* a change in the revision value in geokeys.h          */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+/*  Revised 28 Sep 1995   NDR -- Added Rev. 1.0 aliases. */
+
+/* 6.2.1 GeoTIFF Configuration Keys */
+
+ValuePair(  GTModelTypeGeoKey,	1024) /* Section 6.3.1.1 Codes       */
+ValuePair(  GTRasterTypeGeoKey,	1025) /* Section 6.3.1.2 Codes       */
+ValuePair(  GTCitationGeoKey,	1026) /* documentation */
+
+/* 6.2.2 Geographic CS Parameter Keys */
+
+ValuePair(  GeographicTypeGeoKey,	2048) /* Section 6.3.2.1 Codes     */
+ValuePair(  GeogCitationGeoKey,	2049) /* documentation             */
+ValuePair(  GeogGeodeticDatumGeoKey,	2050) /* Section 6.3.2.2 Codes     */
+ValuePair(  GeogPrimeMeridianGeoKey,	2051) /* Section 6.3.2.4 codes     */
+ValuePair(  GeogLinearUnitsGeoKey,	2052) /* Section 6.3.1.3 Codes     */
+ValuePair(  GeogLinearUnitSizeGeoKey,	2053) /* meters                    */
+ValuePair(  GeogAngularUnitsGeoKey,	2054) /* Section 6.3.1.4 Codes     */
+ValuePair(  GeogAngularUnitSizeGeoKey,	2055) /* radians                   */
+ValuePair(  GeogEllipsoidGeoKey,	2056) /* Section 6.3.2.3 Codes     */
+ValuePair(  GeogSemiMajorAxisGeoKey,	2057) /* GeogLinearUnits           */
+ValuePair(  GeogSemiMinorAxisGeoKey,	2058) /* GeogLinearUnits           */
+ValuePair(  GeogInvFlatteningGeoKey,	2059) /* ratio                     */
+ValuePair(  GeogAzimuthUnitsGeoKey,	2060) /* Section 6.3.1.4 Codes     */
+ValuePair(  GeogPrimeMeridianLongGeoKey,	2061) /* GeoAngularUnit            */
+
+/* 6.2.3 Projected CS Parameter Keys */
+/*    Several keys have been renamed,*/
+/*    and the deprecated names aliased for backward compatibility */
+
+ValuePair(  ProjectedCSTypeGeoKey,	3072)     /* Section 6.3.3.1 codes   */
+ValuePair(  PCSCitationGeoKey,	3073)     /* documentation           */
+ValuePair(  ProjectionGeoKey,	3074)     /* Section 6.3.3.2 codes   */
+ValuePair(  ProjCoordTransGeoKey,	3075)     /* Section 6.3.3.3 codes   */
+ValuePair(  ProjLinearUnitsGeoKey,	3076)     /* Section 6.3.1.3 codes   */
+ValuePair(  ProjLinearUnitSizeGeoKey,	3077)     /* meters                  */
+ValuePair(  ProjStdParallel1GeoKey,	3078)     /* GeogAngularUnit */
+ValuePair(  ProjStdParallelGeoKey,ProjStdParallel1GeoKey) /* ** alias **   */
+ValuePair(  ProjStdParallel2GeoKey,	3079)     /* GeogAngularUnit */
+ValuePair(  ProjNatOriginLongGeoKey,	3080)     /* GeogAngularUnit */
+ValuePair(  ProjOriginLongGeoKey,ProjNatOriginLongGeoKey) /* ** alias **     */
+ValuePair(  ProjNatOriginLatGeoKey,	3081)     /* GeogAngularUnit */
+ValuePair(  ProjOriginLatGeoKey,ProjNatOriginLatGeoKey)   /* ** alias **     */
+ValuePair(  ProjFalseEastingGeoKey,	3082)     /* ProjLinearUnits */
+ValuePair(  ProjFalseNorthingGeoKey,	3083)     /* ProjLinearUnits */
+ValuePair(  ProjFalseOriginLongGeoKey,	3084)     /* GeogAngularUnit */
+ValuePair(  ProjFalseOriginLatGeoKey,	3085)     /* GeogAngularUnit */
+ValuePair(  ProjFalseOriginEastingGeoKey,	3086)     /* ProjLinearUnits */
+ValuePair(  ProjFalseOriginNorthingGeoKey,	3087)     /* ProjLinearUnits */
+ValuePair(  ProjCenterLongGeoKey,	3088)     /* GeogAngularUnit */
+ValuePair(  ProjCenterLatGeoKey,	3089)     /* GeogAngularUnit */
+ValuePair(  ProjCenterEastingGeoKey,	3090)     /* ProjLinearUnits */
+ValuePair(  ProjCenterNorthingGeoKey,	3091)     /* ProjLinearUnits */
+ValuePair(  ProjScaleAtNatOriginGeoKey,	3092)     /* ratio   */
+ValuePair(  ProjScaleAtOriginGeoKey,ProjScaleAtNatOriginGeoKey)  /* ** alias **   */
+ValuePair(  ProjScaleAtCenterGeoKey,	3093)     /* ratio   */
+ValuePair(  ProjAzimuthAngleGeoKey,	3094)     /* GeogAzimuthUnit */
+ValuePair(  ProjStraightVertPoleLongGeoKey, 3095) /* GeogAngularUnit */
+ValuePair(  ProjRectifiedGridAngleGeoKey, 3096)   /* GeogAngularUnit */
+
+/* 6.2.4 Vertical CS Keys */
+   
+ValuePair(  VerticalCSTypeGeoKey,	4096)  /* Section 6.3.4.1 codes   */
+ValuePair(  VerticalCitationGeoKey,	4097)  /* documentation */
+ValuePair(  VerticalDatumGeoKey,	4098)  /* Section 6.3.4.2 codes   */
+ValuePair(  VerticalUnitsGeoKey,	4099)  /* Section 6.3.1 (.x) codes   */
+
+/* End of Data base */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/geonames.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/geonames.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/geonames.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,146 @@
+/*
+ * geonames.h
+ *
+ *  This encapsulates all of the value-naming mechanism of 
+ *  libgeotiff. 
+ *
+ *  Written By: Niles Ritter
+ *
+ *  Revision History:
+ *
+ *      Author     Date     Key Changes/Additions
+ *      ------  ----------  -------------------------------------
+ *      ndr    10 Jun 95     Inital Beta Release
+ *      ndr    28 Jul 95     Added ModelType aliases, Kv aliases.
+ */
+
+#ifndef __geonames_h
+#define __geonames_h
+
+struct _KeyInfo {
+	int ki_key;
+	char *ki_name;
+};
+typedef struct _KeyInfo KeyInfo;
+
+/* If memory is a premium, then omitting the 
+ * long name lists may save some space; simply 
+ * #define OMIT_GEOTIFF_NAMES in the compile statement
+ * to remove all key->string translation.
+ */
+#ifdef ValuePair
+#  undef ValuePair
+#endif
+
+#ifndef OMIT_GEOTIFF_NAMES
+#define ValuePair(token,value)  {token,#token},
+#else
+#define ValuePair(token,value)
+#endif
+
+#define END_LIST { -1, (char *)0}
+
+/************************************************************
+ *         6.2.x GeoTIFF Keys
+ ************************************************************/
+
+static KeyInfo _keyInfo[] =  {
+#   include "geokeys.inc"   /* geokey database */
+    END_LIST
+};
+
+#define COMMON_VALUES \
+   {KvUndefined, "Undefined"}, \
+   {KvUserDefined,"User-Defined"}, \
+   ValuePair(KvUndefined,KvUndefined) \
+   ValuePair(KvUserDefined,KvUserDefined) 
+
+static KeyInfo _csdefaultValue[] = {
+   COMMON_VALUES
+   END_LIST  
+};
+
+/************************************************************
+ *         6.3.x GeoTIFF Key Values
+ ************************************************************/
+
+static KeyInfo _modeltypeValue[] = {
+   COMMON_VALUES
+    ValuePair(ModelTypeProjected,1)
+    ValuePair(ModelTypeGeographic,2)
+    ValuePair(ModelTypeGeocentric,3)
+    ValuePair(ModelProjected,1)     /* aliases */
+    ValuePair(ModelGeographic,2)    /* aliases */
+    ValuePair(ModelGeocentric,3)    /* aliases */
+   END_LIST  
+};
+
+static KeyInfo _rastertypeValue[] = {
+   COMMON_VALUES
+    ValuePair(RasterPixelIsArea,1)
+    ValuePair(RasterPixelIsPoint,2)
+   END_LIST  
+};
+
+static KeyInfo _geounitsValue[] = {
+   COMMON_VALUES
+#  include "epsg_units.inc"
+   END_LIST  
+};
+
+static KeyInfo _geographicValue[] = {
+   COMMON_VALUES
+#  include "epsg_gcs.inc"
+   END_LIST  
+};
+
+static KeyInfo _geodeticdatumValue[] = {
+   COMMON_VALUES
+#  include "epsg_datum.inc"
+   END_LIST  
+};
+
+static KeyInfo _ellipsoidValue[] = {
+   COMMON_VALUES
+#  include "epsg_ellipse.inc"
+   END_LIST  
+};
+
+static KeyInfo _primemeridianValue[] = {
+   COMMON_VALUES
+#  include "epsg_pm.inc"
+   END_LIST  
+};
+
+static KeyInfo _pcstypeValue[] = {
+   COMMON_VALUES
+#  include "epsg_pcs.inc"
+   END_LIST  
+};
+
+static KeyInfo _projectionValue[] = {
+   COMMON_VALUES
+#  include "epsg_proj.inc"
+   END_LIST  
+};
+
+static KeyInfo _coordtransValue[] = {
+   COMMON_VALUES
+#  include "geo_ctrans.inc"
+   END_LIST  
+};
+
+static KeyInfo _vertcstypeValue[] = {
+   COMMON_VALUES
+#  include "epsg_vertcs.inc"
+   END_LIST  
+};
+
+static KeyInfo _vdatumValue[] = {
+   COMMON_VALUES
+    ValuePair(VDatumBase,1)
+   END_LIST  
+};
+
+#endif /* __geonames_h */
+

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/geotiff.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/geotiff.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/geotiff.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,117 @@
+/**********************************************************************
+ *
+ *  geotiff.h - Public interface for Geotiff tag parsing.
+ *
+ *
+ *   Written By: Niles D. Ritter
+ *
+ **********************************************************************/
+
+#ifndef __geotiff_h_
+#define __geotiff_h_
+
+/**
+ * \file geotiff.h
+ *
+ * Primary libgeotiff include file.
+ *
+ * This is the defacto registry for valid GEOTIFF GeoKeys
+ * and their associated symbolic values. This is also the only file
+ * of the GeoTIFF library which needs to be included in client source
+ * code.
+ */
+
+/* This Version code should only change if a drastic
+ * alteration is made to the GeoTIFF key structure. Readers
+ * encountering a larger value should give up gracefully.
+ */
+#define GvCurrentVersion   1
+
+#define LIBGEOTIFF_VERSION 1210
+
+#include "geo_config.h"
+#include "geokeys.h"
+
+/**********************************************************************
+ * Do we want to build as a DLL on windows?
+ **********************************************************************/
+#if !defined(CPL_DLL)
+#  if defined(_WIN32) && defined(BUILD_AS_DLL)
+#    define CPL_DLL     __declspec(dllexport)
+#  else
+#    define CPL_DLL
+#  endif
+#endif
+
+/**********************************************************************
+ *
+ *                 Public Structures & Definitions
+ *
+ **********************************************************************/
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+typedef struct gtiff GTIF;   /* struct gtiff is private */
+typedef unsigned short tifftag_t;
+typedef unsigned short geocode_t;
+typedef int (*GTIFPrintMethod)(char *string, void *aux);
+typedef int (*GTIFReadMethod)(char *string, void *aux);
+
+typedef enum {
+   TYPE_BYTE=1,
+   TYPE_SHORT=2,
+   TYPE_LONG=3,
+   TYPE_RATIONAL=4,
+   TYPE_ASCII=5,
+   TYPE_FLOAT=6,
+   TYPE_DOUBLE=7,
+   TYPE_SBYTE=8,
+   TYPE_SSHORT=9,
+   TYPE_SLONG=10,
+   TYPE_UNKNOWN=11
+} tagtype_t;
+
+
+/**********************************************************************
+ *
+ *                 Public Function Declarations
+ *
+ **********************************************************************/
+
+/* TIFF-level interface */
+GTIF CPL_DLL *GTIFNew(void *tif);
+void CPL_DLL  GTIFFree(GTIF *gtif);
+int  CPL_DLL  GTIFWriteKeys(GTIF *gtif);
+void CPL_DLL  GTIFDirectoryInfo(GTIF *gtif, int *versions, int *keycount);
+
+/* GeoKey Access */
+int  CPL_DLL  GTIFKeyInfo(GTIF *gtif, geokey_t key, int *size, tagtype_t* type);
+int  CPL_DLL  GTIFKeyGet(GTIF *gtif, geokey_t key, void *val, int index,
+                         int count);
+int  CPL_DLL  GTIFKeySet(GTIF *gtif, geokey_t keyID, tagtype_t type,
+                         int count,...);
+
+/* Metadata Import-Export utilities */
+void  CPL_DLL  GTIFPrint(GTIF *gtif, GTIFPrintMethod print, void *aux);
+int   CPL_DLL  GTIFImport(GTIF *gtif, GTIFReadMethod scan, void *aux);
+char  CPL_DLL *GTIFKeyName(geokey_t key);
+char  CPL_DLL *GTIFValueName(geokey_t key,int value);
+char  CPL_DLL *GTIFTypeName(tagtype_t type);
+char  CPL_DLL *GTIFTagName(int tag);
+int   CPL_DLL  GTIFKeyCode(char * key);
+int   CPL_DLL  GTIFValueCode(geokey_t key,char *value);
+int   CPL_DLL  GTIFTypeCode(char *type);
+int   CPL_DLL  GTIFTagCode(char *tag);
+
+/* Translation between image/PCS space */
+
+int CPL_DLL    GTIFImageToPCS( GTIF *gtif, double *x, double *y );
+int CPL_DLL    GTIFPCSToImage( GTIF *gtif, double *x, double *y );
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __geotiff_h_ */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/geotiffio.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/geotiffio.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/geotiffio.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,16 @@
+/* 
+ * geotiffio.h
+ * 
+ * Standard include file for geotiff, including all
+ *  key and code definitions.
+ */
+
+
+#ifndef __geotiffio_h
+#define __geotiffio_h
+
+#include "geotiff.h"  /* public key interface */
+#include "geovalues.h" /* key code definitions */
+
+#endif /* __geotiffio_h */
+

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/geovalues.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/geovalues.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/geovalues.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,120 @@
+/**********************************************************************
+ *
+ *  geovalues.h - Public registry for valid GEOTIFF  key-values.
+ *
+ *   Written By: Niles D. Ritter
+ *
+ *  Revision History:
+ *
+ *     Rev.#  Author     Date     Key Changes/Additions
+ *     -----  ------  ----------  -------------------------------------
+ *      0.1     ndr    10 Jun 95     Inital Beta Release
+ *      0.2     ndr    12 Jul 95     New EPSG Tables installed.
+ *      0.2.1   ndr    28 Jul 95     Added ModelType aliases to Model's
+ *      1.0     ndr    18 Sep 95     Promoted to Revision 1.0
+ *
+ **********************************************************************/
+
+#ifndef __geovalues_h_
+#define __geovalues_h_
+
+/* If code values are added or modified, the "GvCurrentMinorRev" 
+ * number should be incremented here. If new Keys are added, then the
+ * GvCurrentRevision number should be incremented instead, and the
+ * GvCurrentMinorRev should be reset to zero (see "geokeys.h").
+ *
+ * In addition, any changes here should be reflected in "geo_names.c"
+ *
+ */
+ 
+#define GvCurrentMinorRev  0  /* First Major Rev EPSG Code Release  */
+
+
+/*
+ * Universal key values -- defined for consistency
+ */
+#define KvUndefined         0
+#define KvUserDefined   32767
+
+#ifdef ValuePair
+#  undef ValuePair
+#endif
+#define ValuePair(name,value)    name = value,
+
+/*
+ * The section numbers refer to the GeoTIFF Specification section
+ * in which the code values are documented.
+ */
+ 
+/************************************************************
+ *         6.3.1 GeoTIFF General Codes
+ ************************************************************/
+
+/* 6.3.1.1 Model Type Codes */
+typedef enum {
+	ModelTypeProjected  = 1,  /* Projection Coordinate System */
+	ModelTypeGeographic = 2,  /* Geographic latitude-longitude System */
+	ModelTypeGeocentric = 3,   /* Geocentric (X,Y,Z) Coordinate System */
+	ModelProjected  = ModelTypeProjected,   /* alias */
+	ModelGeographic = ModelTypeGeographic,  /* alias */
+	ModelGeocentric = ModelTypeGeocentric   /* alias */
+} modeltype_t;
+
+/* 6.3.1.2 Raster Type Codes */
+typedef enum {
+	RasterPixelIsArea   = 1,  /* Standard pixel-fills-grid-cell */
+	RasterPixelIsPoint  = 2   /* Pixel-at-grid-vertex */
+} rastertype_t;
+
+typedef enum {
+#  include "epsg_gcs.inc"
+  geographic_end
+} geographic_t;
+
+typedef enum {
+#  include "epsg_datum.inc"
+   geodeticdatum_end
+} geodeticdatum_t;
+
+typedef enum {
+#  include "epsg_units.inc"
+   Unit_End
+} geounits_t;
+
+typedef enum {
+#  include "epsg_ellipse.inc"
+    ellipsoid_end
+} ellipsoid_t;
+
+typedef enum {
+#  include "epsg_pm.inc"
+   primemeridian_end
+} primemeridian_t;
+
+typedef enum {
+#  include "epsg_pcs.inc"
+   pcstype_end
+} pcstype_t;
+
+typedef enum {
+#  include "epsg_proj.inc"
+   projection_end
+} projection_t;
+
+typedef enum {
+#  include "geo_ctrans.inc"
+   coordtrans_end
+} coordtrans_t;
+
+typedef enum {
+#  include "epsg_vertcs.inc"
+   vertcs_end
+} vertcstype_t;
+
+
+typedef enum {
+	VDatumBase = 1
+} vdatum_t;
+
+#endif /* __geovalues_h_ */
+

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/port.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/port.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/port.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,32 @@
+/*
+ * Warning, this file was automatically created by the TIFF configure script
+ * VERSION:	 v3.6.0
+ * RELEASE:    beta
+ * DATE:	 Sun Aug 3 15:15:56 EST 2003
+ * TARGET:	 i686-pc-cygwin
+ * CCOMPILER:	 /bin/gcc-3.2.20020927 (prerelease)
+ */
+#ifndef _PORT_
+#define _PORT_ 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <sys/types.h>
+#define HOST_FILLORDER FILLORDER_MSB2LSB
+#define HOST_BIGENDIAN	0
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <fcntl.h>
+typedef double dblparam_t;
+#ifdef __STRICT_ANSI__
+#define	INLINE	__inline__
+#else
+#define	INLINE	inline
+#endif
+#define GLOBALDATA(TYPE,NAME)	extern TYPE NAME
+#ifdef __cplusplus
+}
+#endif
+#endif

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/t4.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/t4.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/t4.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,285 @@
+/* $Id: t4.h,v 1.1.1.1 1999/07/27 21:50:27 mike Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _T4_
+#define	_T4_
+/*
+ * CCITT T.4 1D Huffman runlength codes and
+ * related definitions.  Given the small sizes
+ * of these tables it does not seem
+ * worthwhile to make code & length 8 bits.
+ */
+typedef struct tableentry {
+    unsigned short length;	/* bit length of g3 code */
+    unsigned short code;	/* g3 code */
+    short	runlen;		/* run length in bits */
+} tableentry;
+
+#define	EOL	0x001	/* EOL code value - 0000 0000 0000 1 */
+
+/* status values returned instead of a run length */
+#define	G3CODE_EOL	-1	/* NB: ACT_EOL - ACT_WRUNT */
+#define	G3CODE_INVALID	-2	/* NB: ACT_INVALID - ACT_WRUNT */
+#define	G3CODE_EOF	-3	/* end of input data */
+#define	G3CODE_INCOMP	-4	/* incomplete run code */
+
+/*
+ * Note that these tables are ordered such that the
+ * index into the table is known to be either the
+ * run length, or (run length / 64) + a fixed offset.
+ *
+ * NB: The G3CODE_INVALID entries are only used
+ *     during state generation (see mkg3states.c).
+ */
+#ifdef G3CODES
+const tableentry TIFFFaxWhiteCodes[] = {
+    { 8, 0x35, 0 },	/* 0011 0101 */
+    { 6, 0x7, 1 },	/* 0001 11 */
+    { 4, 0x7, 2 },	/* 0111 */
+    { 4, 0x8, 3 },	/* 1000 */
+    { 4, 0xB, 4 },	/* 1011 */
+    { 4, 0xC, 5 },	/* 1100 */
+    { 4, 0xE, 6 },	/* 1110 */
+    { 4, 0xF, 7 },	/* 1111 */
+    { 5, 0x13, 8 },	/* 1001 1 */
+    { 5, 0x14, 9 },	/* 1010 0 */
+    { 5, 0x7, 10 },	/* 0011 1 */
+    { 5, 0x8, 11 },	/* 0100 0 */
+    { 6, 0x8, 12 },	/* 0010 00 */
+    { 6, 0x3, 13 },	/* 0000 11 */
+    { 6, 0x34, 14 },	/* 1101 00 */
+    { 6, 0x35, 15 },	/* 1101 01 */
+    { 6, 0x2A, 16 },	/* 1010 10 */
+    { 6, 0x2B, 17 },	/* 1010 11 */
+    { 7, 0x27, 18 },	/* 0100 111 */
+    { 7, 0xC, 19 },	/* 0001 100 */
+    { 7, 0x8, 20 },	/* 0001 000 */
+    { 7, 0x17, 21 },	/* 0010 111 */
+    { 7, 0x3, 22 },	/* 0000 011 */
+    { 7, 0x4, 23 },	/* 0000 100 */
+    { 7, 0x28, 24 },	/* 0101 000 */
+    { 7, 0x2B, 25 },	/* 0101 011 */
+    { 7, 0x13, 26 },	/* 0010 011 */
+    { 7, 0x24, 27 },	/* 0100 100 */
+    { 7, 0x18, 28 },	/* 0011 000 */
+    { 8, 0x2, 29 },	/* 0000 0010 */
+    { 8, 0x3, 30 },	/* 0000 0011 */
+    { 8, 0x1A, 31 },	/* 0001 1010 */
+    { 8, 0x1B, 32 },	/* 0001 1011 */
+    { 8, 0x12, 33 },	/* 0001 0010 */
+    { 8, 0x13, 34 },	/* 0001 0011 */
+    { 8, 0x14, 35 },	/* 0001 0100 */
+    { 8, 0x15, 36 },	/* 0001 0101 */
+    { 8, 0x16, 37 },	/* 0001 0110 */
+    { 8, 0x17, 38 },	/* 0001 0111 */
+    { 8, 0x28, 39 },	/* 0010 1000 */
+    { 8, 0x29, 40 },	/* 0010 1001 */
+    { 8, 0x2A, 41 },	/* 0010 1010 */
+    { 8, 0x2B, 42 },	/* 0010 1011 */
+    { 8, 0x2C, 43 },	/* 0010 1100 */
+    { 8, 0x2D, 44 },	/* 0010 1101 */
+    { 8, 0x4, 45 },	/* 0000 0100 */
+    { 8, 0x5, 46 },	/* 0000 0101 */
+    { 8, 0xA, 47 },	/* 0000 1010 */
+    { 8, 0xB, 48 },	/* 0000 1011 */
+    { 8, 0x52, 49 },	/* 0101 0010 */
+    { 8, 0x53, 50 },	/* 0101 0011 */
+    { 8, 0x54, 51 },	/* 0101 0100 */
+    { 8, 0x55, 52 },	/* 0101 0101 */
+    { 8, 0x24, 53 },	/* 0010 0100 */
+    { 8, 0x25, 54 },	/* 0010 0101 */
+    { 8, 0x58, 55 },	/* 0101 1000 */
+    { 8, 0x59, 56 },	/* 0101 1001 */
+    { 8, 0x5A, 57 },	/* 0101 1010 */
+    { 8, 0x5B, 58 },	/* 0101 1011 */
+    { 8, 0x4A, 59 },	/* 0100 1010 */
+    { 8, 0x4B, 60 },	/* 0100 1011 */
+    { 8, 0x32, 61 },	/* 0011 0010 */
+    { 8, 0x33, 62 },	/* 0011 0011 */
+    { 8, 0x34, 63 },	/* 0011 0100 */
+    { 5, 0x1B, 64 },	/* 1101 1 */
+    { 5, 0x12, 128 },	/* 1001 0 */
+    { 6, 0x17, 192 },	/* 0101 11 */
+    { 7, 0x37, 256 },	/* 0110 111 */
+    { 8, 0x36, 320 },	/* 0011 0110 */
+    { 8, 0x37, 384 },	/* 0011 0111 */
+    { 8, 0x64, 448 },	/* 0110 0100 */
+    { 8, 0x65, 512 },	/* 0110 0101 */
+    { 8, 0x68, 576 },	/* 0110 1000 */
+    { 8, 0x67, 640 },	/* 0110 0111 */
+    { 9, 0xCC, 704 },	/* 0110 0110 0 */
+    { 9, 0xCD, 768 },	/* 0110 0110 1 */
+    { 9, 0xD2, 832 },	/* 0110 1001 0 */
+    { 9, 0xD3, 896 },	/* 0110 1001 1 */
+    { 9, 0xD4, 960 },	/* 0110 1010 0 */
+    { 9, 0xD5, 1024 },	/* 0110 1010 1 */
+    { 9, 0xD6, 1088 },	/* 0110 1011 0 */
+    { 9, 0xD7, 1152 },	/* 0110 1011 1 */
+    { 9, 0xD8, 1216 },	/* 0110 1100 0 */
+    { 9, 0xD9, 1280 },	/* 0110 1100 1 */
+    { 9, 0xDA, 1344 },	/* 0110 1101 0 */
+    { 9, 0xDB, 1408 },	/* 0110 1101 1 */
+    { 9, 0x98, 1472 },	/* 0100 1100 0 */
+    { 9, 0x99, 1536 },	/* 0100 1100 1 */
+    { 9, 0x9A, 1600 },	/* 0100 1101 0 */
+    { 6, 0x18, 1664 },	/* 0110 00 */
+    { 9, 0x9B, 1728 },	/* 0100 1101 1 */
+    { 11, 0x8, 1792 },	/* 0000 0001 000 */
+    { 11, 0xC, 1856 },	/* 0000 0001 100 */
+    { 11, 0xD, 1920 },	/* 0000 0001 101 */
+    { 12, 0x12, 1984 },	/* 0000 0001 0010 */
+    { 12, 0x13, 2048 },	/* 0000 0001 0011 */
+    { 12, 0x14, 2112 },	/* 0000 0001 0100 */
+    { 12, 0x15, 2176 },	/* 0000 0001 0101 */
+    { 12, 0x16, 2240 },	/* 0000 0001 0110 */
+    { 12, 0x17, 2304 },	/* 0000 0001 0111 */
+    { 12, 0x1C, 2368 },	/* 0000 0001 1100 */
+    { 12, 0x1D, 2432 },	/* 0000 0001 1101 */
+    { 12, 0x1E, 2496 },	/* 0000 0001 1110 */
+    { 12, 0x1F, 2560 },	/* 0000 0001 1111 */
+    { 12, 0x1, G3CODE_EOL },	/* 0000 0000 0001 */
+    { 9, 0x1, G3CODE_INVALID },	/* 0000 0000 1 */
+    { 10, 0x1, G3CODE_INVALID },	/* 0000 0000 01 */
+    { 11, 0x1, G3CODE_INVALID },	/* 0000 0000 001 */
+    { 12, 0x0, G3CODE_INVALID },	/* 0000 0000 0000 */
+};
+
+const tableentry TIFFFaxBlackCodes[] = {
+    { 10, 0x37, 0 },	/* 0000 1101 11 */
+    { 3, 0x2, 1 },	/* 010 */
+    { 2, 0x3, 2 },	/* 11 */
+    { 2, 0x2, 3 },	/* 10 */
+    { 3, 0x3, 4 },	/* 011 */
+    { 4, 0x3, 5 },	/* 0011 */
+    { 4, 0x2, 6 },	/* 0010 */
+    { 5, 0x3, 7 },	/* 0001 1 */
+    { 6, 0x5, 8 },	/* 0001 01 */
+    { 6, 0x4, 9 },	/* 0001 00 */
+    { 7, 0x4, 10 },	/* 0000 100 */
+    { 7, 0x5, 11 },	/* 0000 101 */
+    { 7, 0x7, 12 },	/* 0000 111 */
+    { 8, 0x4, 13 },	/* 0000 0100 */
+    { 8, 0x7, 14 },	/* 0000 0111 */
+    { 9, 0x18, 15 },	/* 0000 1100 0 */
+    { 10, 0x17, 16 },	/* 0000 0101 11 */
+    { 10, 0x18, 17 },	/* 0000 0110 00 */
+    { 10, 0x8, 18 },	/* 0000 0010 00 */
+    { 11, 0x67, 19 },	/* 0000 1100 111 */
+    { 11, 0x68, 20 },	/* 0000 1101 000 */
+    { 11, 0x6C, 21 },	/* 0000 1101 100 */
+    { 11, 0x37, 22 },	/* 0000 0110 111 */
+    { 11, 0x28, 23 },	/* 0000 0101 000 */
+    { 11, 0x17, 24 },	/* 0000 0010 111 */
+    { 11, 0x18, 25 },	/* 0000 0011 000 */
+    { 12, 0xCA, 26 },	/* 0000 1100 1010 */
+    { 12, 0xCB, 27 },	/* 0000 1100 1011 */
+    { 12, 0xCC, 28 },	/* 0000 1100 1100 */
+    { 12, 0xCD, 29 },	/* 0000 1100 1101 */
+    { 12, 0x68, 30 },	/* 0000 0110 1000 */
+    { 12, 0x69, 31 },	/* 0000 0110 1001 */
+    { 12, 0x6A, 32 },	/* 0000 0110 1010 */
+    { 12, 0x6B, 33 },	/* 0000 0110 1011 */
+    { 12, 0xD2, 34 },	/* 0000 1101 0010 */
+    { 12, 0xD3, 35 },	/* 0000 1101 0011 */
+    { 12, 0xD4, 36 },	/* 0000 1101 0100 */
+    { 12, 0xD5, 37 },	/* 0000 1101 0101 */
+    { 12, 0xD6, 38 },	/* 0000 1101 0110 */
+    { 12, 0xD7, 39 },	/* 0000 1101 0111 */
+    { 12, 0x6C, 40 },	/* 0000 0110 1100 */
+    { 12, 0x6D, 41 },	/* 0000 0110 1101 */
+    { 12, 0xDA, 42 },	/* 0000 1101 1010 */
+    { 12, 0xDB, 43 },	/* 0000 1101 1011 */
+    { 12, 0x54, 44 },	/* 0000 0101 0100 */
+    { 12, 0x55, 45 },	/* 0000 0101 0101 */
+    { 12, 0x56, 46 },	/* 0000 0101 0110 */
+    { 12, 0x57, 47 },	/* 0000 0101 0111 */
+    { 12, 0x64, 48 },	/* 0000 0110 0100 */
+    { 12, 0x65, 49 },	/* 0000 0110 0101 */
+    { 12, 0x52, 50 },	/* 0000 0101 0010 */
+    { 12, 0x53, 51 },	/* 0000 0101 0011 */
+    { 12, 0x24, 52 },	/* 0000 0010 0100 */
+    { 12, 0x37, 53 },	/* 0000 0011 0111 */
+    { 12, 0x38, 54 },	/* 0000 0011 1000 */
+    { 12, 0x27, 55 },	/* 0000 0010 0111 */
+    { 12, 0x28, 56 },	/* 0000 0010 1000 */
+    { 12, 0x58, 57 },	/* 0000 0101 1000 */
+    { 12, 0x59, 58 },	/* 0000 0101 1001 */
+    { 12, 0x2B, 59 },	/* 0000 0010 1011 */
+    { 12, 0x2C, 60 },	/* 0000 0010 1100 */
+    { 12, 0x5A, 61 },	/* 0000 0101 1010 */
+    { 12, 0x66, 62 },	/* 0000 0110 0110 */
+    { 12, 0x67, 63 },	/* 0000 0110 0111 */
+    { 10, 0xF, 64 },	/* 0000 0011 11 */
+    { 12, 0xC8, 128 },	/* 0000 1100 1000 */
+    { 12, 0xC9, 192 },	/* 0000 1100 1001 */
+    { 12, 0x5B, 256 },	/* 0000 0101 1011 */
+    { 12, 0x33, 320 },	/* 0000 0011 0011 */
+    { 12, 0x34, 384 },	/* 0000 0011 0100 */
+    { 12, 0x35, 448 },	/* 0000 0011 0101 */
+    { 13, 0x6C, 512 },	/* 0000 0011 0110 0 */
+    { 13, 0x6D, 576 },	/* 0000 0011 0110 1 */
+    { 13, 0x4A, 640 },	/* 0000 0010 0101 0 */
+    { 13, 0x4B, 704 },	/* 0000 0010 0101 1 */
+    { 13, 0x4C, 768 },	/* 0000 0010 0110 0 */
+    { 13, 0x4D, 832 },	/* 0000 0010 0110 1 */
+    { 13, 0x72, 896 },	/* 0000 0011 1001 0 */
+    { 13, 0x73, 960 },	/* 0000 0011 1001 1 */
+    { 13, 0x74, 1024 },	/* 0000 0011 1010 0 */
+    { 13, 0x75, 1088 },	/* 0000 0011 1010 1 */
+    { 13, 0x76, 1152 },	/* 0000 0011 1011 0 */
+    { 13, 0x77, 1216 },	/* 0000 0011 1011 1 */
+    { 13, 0x52, 1280 },	/* 0000 0010 1001 0 */
+    { 13, 0x53, 1344 },	/* 0000 0010 1001 1 */
+    { 13, 0x54, 1408 },	/* 0000 0010 1010 0 */
+    { 13, 0x55, 1472 },	/* 0000 0010 1010 1 */
+    { 13, 0x5A, 1536 },	/* 0000 0010 1101 0 */
+    { 13, 0x5B, 1600 },	/* 0000 0010 1101 1 */
+    { 13, 0x64, 1664 },	/* 0000 0011 0010 0 */
+    { 13, 0x65, 1728 },	/* 0000 0011 0010 1 */
+    { 11, 0x8, 1792 },	/* 0000 0001 000 */
+    { 11, 0xC, 1856 },	/* 0000 0001 100 */
+    { 11, 0xD, 1920 },	/* 0000 0001 101 */
+    { 12, 0x12, 1984 },	/* 0000 0001 0010 */
+    { 12, 0x13, 2048 },	/* 0000 0001 0011 */
+    { 12, 0x14, 2112 },	/* 0000 0001 0100 */
+    { 12, 0x15, 2176 },	/* 0000 0001 0101 */
+    { 12, 0x16, 2240 },	/* 0000 0001 0110 */
+    { 12, 0x17, 2304 },	/* 0000 0001 0111 */
+    { 12, 0x1C, 2368 },	/* 0000 0001 1100 */
+    { 12, 0x1D, 2432 },	/* 0000 0001 1101 */
+    { 12, 0x1E, 2496 },	/* 0000 0001 1110 */
+    { 12, 0x1F, 2560 },	/* 0000 0001 1111 */
+    { 12, 0x1, G3CODE_EOL },	/* 0000 0000 0001 */
+    { 9, 0x1, G3CODE_INVALID },	/* 0000 0000 1 */
+    { 10, 0x1, G3CODE_INVALID },	/* 0000 0000 01 */
+    { 11, 0x1, G3CODE_INVALID },	/* 0000 0000 001 */
+    { 12, 0x0, G3CODE_INVALID },	/* 0000 0000 0000 */
+};
+#else
+extern	const tableentry TIFFFaxWhiteCodes[];
+extern	const tableentry TIFFFaxBlackCodes[];
+#endif
+#endif /* _T4_ */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_dir.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_dir.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_dir.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,267 @@
+/* $Header: /cvsroot/osrs/libtiff/libtiff/tif_dir.h,v 1.11 2003/11/18 15:45:43 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _TIFFDIR_
+#define	_TIFFDIR_
+/*
+ * ``Library-private'' Directory-related Definitions.
+ */
+
+/*
+ * Internal format of a TIFF directory entry.
+ */
+typedef	struct {
+#define	FIELD_SETLONGS	4
+	/* bit vector of fields that are set */
+	u_long	td_fieldsset[FIELD_SETLONGS];
+
+	uint32	td_imagewidth, td_imagelength, td_imagedepth;
+	uint32	td_tilewidth, td_tilelength, td_tiledepth;
+	uint32	td_subfiletype;
+	uint16	td_bitspersample;
+	uint16	td_sampleformat;
+	uint16	td_compression;
+	uint16	td_photometric;
+	uint16	td_threshholding;
+	uint16	td_fillorder;
+	uint16	td_orientation;
+	uint16	td_samplesperpixel;
+	uint32	td_rowsperstrip;
+	uint16	td_minsamplevalue, td_maxsamplevalue;
+	double	td_sminsamplevalue, td_smaxsamplevalue;
+	float	td_xresolution, td_yresolution;
+	uint16	td_resolutionunit;
+	uint16	td_planarconfig;
+	float	td_xposition, td_yposition;
+	uint16	td_pagenumber[2];
+	uint16*	td_colormap[3];
+	uint16	td_halftonehints[2];
+	uint16	td_extrasamples;
+	uint16*	td_sampleinfo;
+	double	td_stonits;
+	char*	td_documentname;
+	char*	td_artist;
+	char*	td_datetime;
+	char*	td_hostcomputer;
+	char*	td_imagedescription;
+	char*	td_make;
+	char*	td_model;
+        char*   td_copyright;
+	char*	td_pagename;
+	tstrip_t td_stripsperimage;
+	tstrip_t td_nstrips;		/* size of offset & bytecount arrays */
+	uint32*	td_stripoffset;
+	uint32*	td_stripbytecount;
+#if SUBIFD_SUPPORT
+	uint16	td_nsubifd;
+	uint32*	td_subifd;
+#endif
+#ifdef YCBCR_SUPPORT
+	float*	td_ycbcrcoeffs;
+	uint16	td_ycbcrsubsampling[2];
+	uint16	td_ycbcrpositioning;
+#endif
+#ifdef COLORIMETRY_SUPPORT
+	float*	td_whitepoint;
+	float*	td_primarychromas;
+	float*	td_refblackwhite;
+	uint16*	td_transferfunction[3];
+#endif
+#ifdef CMYK_SUPPORT
+	uint16	td_inkset;
+	uint16	td_ninks;
+	uint16	td_dotrange[2];
+	int	td_inknameslen;
+	char*	td_inknames;
+	char*	td_targetprinter;
+#endif
+#ifdef ICC_SUPPORT
+	uint32	td_profileLength;
+	void	*td_profileData;
+#endif
+#ifdef PHOTOSHOP_SUPPORT
+	uint32	td_photoshopLength;
+	void	*td_photoshopData;
+#endif
+#ifdef IPTC_SUPPORT
+	uint32	td_richtiffiptcLength;
+	void	*td_richtiffiptcData;
+#endif
+        /* Begin Pixar Tag values. */
+        uint32	td_imagefullwidth, td_imagefulllength;
+ 	char*	td_textureformat;
+ 	char*	td_wrapmodes;
+ 	float	td_fovcot;
+ 	float*	td_matrixWorldToScreen;
+ 	float*	td_matrixWorldToCamera;
+ 	/* End Pixar Tag Values. */
+	uint32	td_xmlpacketLength;
+	void	*td_xmlpacketData;
+		int     td_customValueCount;
+        TIFFTagValue *td_customValues;
+} TIFFDirectory;
+
+/*
+ * Field flags used to indicate fields that have
+ * been set in a directory, and to reference fields
+ * when manipulating a directory.
+ */
+
+/*
+ * FIELD_IGNORE is used to signify tags that are to
+ * be processed but otherwise ignored.  This permits
+ * antiquated tags to be quietly read and discarded.
+ * Note that a bit *is* allocated for ignored tags;
+ * this is understood by the directory reading logic
+ * which uses this fact to avoid special-case handling
+ */ 
+#define	FIELD_IGNORE			0
+
+/* multi-item fields */
+#define	FIELD_IMAGEDIMENSIONS		1
+#define FIELD_TILEDIMENSIONS		2
+#define	FIELD_RESOLUTION		3
+#define	FIELD_POSITION			4
+
+/* single-item fields */
+#define	FIELD_SUBFILETYPE		5
+#define	FIELD_BITSPERSAMPLE		6
+#define	FIELD_COMPRESSION		7
+#define	FIELD_PHOTOMETRIC		8
+#define	FIELD_THRESHHOLDING		9
+#define	FIELD_FILLORDER			10
+#define	FIELD_DOCUMENTNAME		11
+#define	FIELD_IMAGEDESCRIPTION		12
+#define	FIELD_MAKE			13
+#define	FIELD_MODEL			14
+#define	FIELD_ORIENTATION		15
+#define	FIELD_SAMPLESPERPIXEL		16
+#define	FIELD_ROWSPERSTRIP		17
+#define	FIELD_MINSAMPLEVALUE		18
+#define	FIELD_MAXSAMPLEVALUE		19
+#define	FIELD_PLANARCONFIG		20
+#define	FIELD_PAGENAME			21
+#define	FIELD_RESOLUTIONUNIT		22
+#define	FIELD_PAGENUMBER		23
+#define	FIELD_STRIPBYTECOUNTS		24
+#define	FIELD_STRIPOFFSETS		25
+#define	FIELD_COLORMAP			26
+#define FIELD_ARTIST			27
+#define FIELD_DATETIME			28
+#define FIELD_HOSTCOMPUTER		29
+/* unused - was FIELD_SOFTWARE          30 */
+#define	FIELD_EXTRASAMPLES		31
+#define FIELD_SAMPLEFORMAT		32
+#define	FIELD_SMINSAMPLEVALUE		33
+#define	FIELD_SMAXSAMPLEVALUE		34
+#define FIELD_IMAGEDEPTH		35
+#define FIELD_TILEDEPTH			36
+#define	FIELD_HALFTONEHINTS		37
+#define FIELD_YCBCRCOEFFICIENTS		38
+#define FIELD_YCBCRSUBSAMPLING		39
+#define FIELD_YCBCRPOSITIONING		40
+#define	FIELD_REFBLACKWHITE		41
+#define	FIELD_WHITEPOINT		42
+#define	FIELD_PRIMARYCHROMAS		43
+#define	FIELD_TRANSFERFUNCTION		44
+#define	FIELD_INKSET			45
+#define	FIELD_INKNAMES			46
+#define	FIELD_DOTRANGE			47
+#define	FIELD_TARGETPRINTER		48
+#define	FIELD_SUBIFD			49
+#define	FIELD_NUMBEROFINKS		50
+#define FIELD_ICCPROFILE		51
+#define FIELD_PHOTOSHOP			52
+#define FIELD_RICHTIFFIPTC		53
+#define FIELD_STONITS			54
+/* Begin PIXAR */
+#define	FIELD_IMAGEFULLWIDTH		55
+#define	FIELD_IMAGEFULLLENGTH		56
+#define FIELD_TEXTUREFORMAT		57
+#define FIELD_WRAPMODES			58
+#define FIELD_FOVCOT			59
+#define FIELD_MATRIX_WORLDTOSCREEN	60
+#define FIELD_MATRIX_WORLDTOCAMERA	61
+#define FIELD_COPYRIGHT			62
+#define FIELD_XMLPACKET			63
+/*      FIELD_CUSTOM (see tiffio.h)     65 */
+/* end of support for well-known tags; codec-private tags follow */
+#define	FIELD_CODEC			66	/* base of codec-private tags */
+
+
+/*
+ * Pseudo-tags don't normally need field bits since they
+ * are not written to an output file (by definition).
+ * The library also has express logic to always query a
+ * codec for a pseudo-tag so allocating a field bit for
+ * one is a waste.   If codec wants to promote the notion
+ * of a pseudo-tag being ``set'' or ``unset'' then it can
+ * do using internal state flags without polluting the
+ * field bit space defined for real tags.
+ */
+#define	FIELD_PSEUDO			0
+
+#define	FIELD_LAST			(32*FIELD_SETLONGS-1)
+
+#define	TIFFExtractData(tif, type, v) \
+    ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
+        ((v) >> (tif)->tif_typeshift[type]) & (tif)->tif_typemask[type] : \
+	(v) & (tif)->tif_typemask[type]))
+#define	TIFFInsertData(tif, type, v) \
+    ((uint32) ((tif)->tif_header.tiff_magic == TIFF_BIGENDIAN ? \
+        ((v) & (tif)->tif_typemask[type]) << (tif)->tif_typeshift[type] : \
+	(v) & (tif)->tif_typemask[type]))
+
+
+#define BITn(n)				(((u_long)1L)<<((n)&0x1f)) 
+#define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32]) 
+#define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field)) 
+#define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
+#define TIFFClrFieldBit(tif, field)	(BITFIELDn(tif, field) &= ~BITn(field))
+
+#define	FieldSet(fields, f)		(fields[(f)/32] & BITn(f))
+#define	ResetFieldBit(fields, f)	(fields[(f)/32] &= ~BITn(f))
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+extern	void _TIFFSetupFieldInfo(TIFF*);
+extern	void _TIFFPrintFieldInfo(TIFF*, FILE*);
+extern	TIFFDataType _TIFFSampleToTagType(TIFF*);
+extern  const TIFFFieldInfo* _TIFFFindOrRegisterFieldInfo( TIFF *tif,
+							   ttag_t tag,
+							   TIFFDataType dt );
+extern  TIFFFieldInfo* _TIFFCreateAnonFieldInfo( TIFF *tif, ttag_t tag,
+                                                 TIFFDataType dt );
+
+#define _TIFFMergeFieldInfo TIFFMergeFieldInfo
+#define _TIFFFindFieldInfo  TIFFFindFieldInfo
+#define _TIFFFieldWithTag   TIFFFieldWithTag
+    
+#if defined(__cplusplus)
+}
+#endif
+#endif /* _TIFFDIR_ */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_fax3.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_fax3.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_fax3.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,525 @@
+/* $Id: tif_fax3.h,v 1.4 2000/12/01 15:46:46 warmerda Exp $ */
+
+/*
+ * Copyright (c) 1990-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _FAX3_
+#define	_FAX3_
+/*
+ * TIFF Library.
+ *
+ * CCITT Group 3 (T.4) and Group 4 (T.6) Decompression Support.
+ *
+ * Decoder support is derived, with permission, from the code
+ * in Frank Cringle's viewfax program;
+ *      Copyright (C) 1990, 1995  Frank D. Cringle.
+ */
+#include "tiff.h"
+
+/*
+ * To override the default routine used to image decoded
+ * spans one can use the pseduo tag TIFFTAG_FAXFILLFUNC.
+ * The routine must have the type signature given below;
+ * for example:
+ *
+ * fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
+ *
+ * where buf is place to set the bits, runs is the array of b&w run
+ * lengths (white then black), erun is the last run in the array, and
+ * lastx is the width of the row in pixels.  Fill routines can assume
+ * the run array has room for at least lastx runs and can overwrite
+ * data in the run array as needed (e.g. to append zero runs to bring
+ * the count up to a nice multiple).
+ */
+typedef	void (*TIFFFaxFillFunc)(unsigned char*, uint32*, uint32*, uint32);
+
+/*
+ * The default run filler; made external for other decoders.
+ */
+#if defined(__cplusplus)
+extern "C" {
+#endif
+extern	void _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32);
+#if defined(__cplusplus)
+}
+#endif
+
+
+/* finite state machine codes */
+#define S_Null		0
+#define S_Pass		1
+#define S_Horiz		2
+#define S_V0		3
+#define S_VR		4
+#define S_VL		5
+#define S_Ext		6
+#define S_TermW		7
+#define S_TermB		8
+#define S_MakeUpW	9
+#define S_MakeUpB	10
+#define S_MakeUp	11
+#define S_EOL		12
+
+typedef struct {		/* state table entry */
+	unsigned char State;	/* see above */
+	unsigned char Width;	/* width of code in bits */
+	uint32	Param;		/* unsigned 32-bit run length in bits */
+} TIFFFaxTabEnt;
+
+extern	const TIFFFaxTabEnt TIFFFaxMainTable[];
+extern	const TIFFFaxTabEnt TIFFFaxWhiteTable[];
+extern	const TIFFFaxTabEnt TIFFFaxBlackTable[];
+
+/*
+ * The following macros define the majority of the G3/G4 decoder
+ * algorithm using the state tables defined elsewhere.  To build
+ * a decoder you need some setup code and some glue code. Note
+ * that you may also need/want to change the way the NeedBits*
+ * macros get input data if, for example, you know the data to be
+ * decoded is properly aligned and oriented (doing so before running
+ * the decoder can be a big performance win).
+ *
+ * Consult the decoder in the TIFF library for an idea of what you
+ * need to define and setup to make use of these definitions.
+ *
+ * NB: to enable a debugging version of these macros define FAX3_DEBUG
+ *     before including this file.  Trace output goes to stdout.
+ */
+
+#ifndef EndOfData
+#define EndOfData()	(cp >= ep)
+#endif
+/*
+ * Need <=8 or <=16 bits of input data.  Unlike viewfax we
+ * cannot use/assume a word-aligned, properly bit swizzled
+ * input data set because data may come from an arbitrarily
+ * aligned, read-only source such as a memory-mapped file.
+ * Note also that the viewfax decoder does not check for
+ * running off the end of the input data buffer.  This is
+ * possible for G3-encoded data because it prescans the input
+ * data to count EOL markers, but can cause problems for G4
+ * data.  In any event, we don't prescan and must watch for
+ * running out of data since we can't permit the library to
+ * scan past the end of the input data buffer.
+ *
+ * Finally, note that we must handle remaindered data at the end
+ * of a strip specially.  The coder asks for a fixed number of
+ * bits when scanning for the next code.  This may be more bits
+ * than are actually present in the data stream.  If we appear
+ * to run out of data but still have some number of valid bits
+ * remaining then we makeup the requested amount with zeros and
+ * return successfully.  If the returned data is incorrect then
+ * we should be called again and get a premature EOF error;
+ * otherwise we should get the right answer.
+ */
+#ifndef NeedBits8
+#define NeedBits8(n,eoflab) do {					\
+    if (BitsAvail < (n)) {						\
+	if (EndOfData()) {						\
+	    if (BitsAvail == 0)			/* no valid bits */	\
+		goto eoflab;						\
+	    BitsAvail = (n);			/* pad with zeros */	\
+	} else {							\
+	    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;		\
+	    BitsAvail += 8;						\
+	}								\
+    }									\
+} while (0)
+#endif
+#ifndef NeedBits16
+#define NeedBits16(n,eoflab) do {					\
+    if (BitsAvail < (n)) {						\
+	if (EndOfData()) {						\
+	    if (BitsAvail == 0)			/* no valid bits */	\
+		goto eoflab;						\
+	    BitsAvail = (n);			/* pad with zeros */	\
+	} else {							\
+	    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;		\
+	    if ((BitsAvail += 8) < (n)) {				\
+		if (EndOfData()) {					\
+		    /* NB: we know BitsAvail is non-zero here */	\
+		    BitsAvail = (n);		/* pad with zeros */	\
+		} else {						\
+		    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;	\
+		    BitsAvail += 8;					\
+		}							\
+	    }								\
+	}								\
+    }									\
+} while (0)
+#endif
+#define GetBits(n)	(BitAcc & ((1<<(n))-1))
+#define ClrBits(n) do {							\
+    BitsAvail -= (n);							\
+    BitAcc >>= (n);							\
+} while (0)
+
+#ifdef FAX3_DEBUG
+static const char* StateNames[] = {
+    "Null   ",
+    "Pass   ",
+    "Horiz  ",
+    "V0     ",
+    "VR     ",
+    "VL     ",
+    "Ext    ",
+    "TermW  ",
+    "TermB  ",
+    "MakeUpW",
+    "MakeUpB",
+    "MakeUp ",
+    "EOL    ",
+};
+#define DEBUG_SHOW putchar(BitAcc & (1 << t) ? '1' : '0')
+#define LOOKUP8(wid,tab,eoflab) do {					\
+    int t;								\
+    NeedBits8(wid,eoflab);						\
+    TabEnt = tab + GetBits(wid);					\
+    printf("%08lX/%d: %s%5d\t", (long) BitAcc, BitsAvail,		\
+	   StateNames[TabEnt->State], TabEnt->Param);			\
+    for (t = 0; t < TabEnt->Width; t++)					\
+	DEBUG_SHOW;							\
+    putchar('\n');							\
+    fflush(stdout);							\
+    ClrBits(TabEnt->Width);						\
+} while (0)
+#define LOOKUP16(wid,tab,eoflab) do {					\
+    int t;								\
+    NeedBits16(wid,eoflab);						\
+    TabEnt = tab + GetBits(wid);					\
+    printf("%08lX/%d: %s%5d\t", (long) BitAcc, BitsAvail,		\
+	   StateNames[TabEnt->State], TabEnt->Param);			\
+    for (t = 0; t < TabEnt->Width; t++)					\
+	DEBUG_SHOW;							\
+    putchar('\n');							\
+    fflush(stdout);							\
+    ClrBits(TabEnt->Width);						\
+} while (0)
+
+#define SETVAL(x) do {							\
+    *pa++ = RunLength + (x);						\
+    printf("SETVAL: %d\t%d\n", RunLength + (x), a0);			\
+    a0 += x;								\
+    RunLength = 0;							\
+} while (0)
+#else
+#define LOOKUP8(wid,tab,eoflab) do {					\
+    NeedBits8(wid,eoflab);						\
+    TabEnt = tab + GetBits(wid);					\
+    ClrBits(TabEnt->Width);						\
+} while (0)
+#define LOOKUP16(wid,tab,eoflab) do {					\
+    NeedBits16(wid,eoflab);						\
+    TabEnt = tab + GetBits(wid);					\
+    ClrBits(TabEnt->Width);						\
+} while (0)
+
+/*
+ * Append a run to the run length array for the
+ * current row and reset decoding state.
+ */
+#define SETVAL(x) do {							\
+    *pa++ = RunLength + (x);						\
+    a0 += (x);								\
+    RunLength = 0;							\
+} while (0)
+#endif
+
+/*
+ * Synchronize input decoding at the start of each
+ * row by scanning for an EOL (if appropriate) and
+ * skipping any trash data that might be present
+ * after a decoding error.  Note that the decoding
+ * done elsewhere that recognizes an EOL only consumes
+ * 11 consecutive zero bits.  This means that if EOLcnt
+ * is non-zero then we still need to scan for the final flag
+ * bit that is part of the EOL code.
+ */
+#define	SYNC_EOL(eoflab) do {						\
+    if (EOLcnt == 0) {							\
+	for (;;) {							\
+	    NeedBits16(11,eoflab);					\
+	    if (GetBits(11) == 0)					\
+		break;							\
+	    ClrBits(1);							\
+	}								\
+    }									\
+    for (;;) {								\
+	NeedBits8(8,eoflab);						\
+	if (GetBits(8))							\
+	    break;							\
+	ClrBits(8);							\
+    }									\
+    while (GetBits(1) == 0)						\
+	ClrBits(1);							\
+    ClrBits(1);				/* EOL bit */			\
+    EOLcnt = 0;				/* reset EOL counter/flag */	\
+} while (0)
+
+/*
+ * Cleanup the array of runs after decoding a row.
+ * We adjust final runs to insure the user buffer is not
+ * overwritten and/or undecoded area is white filled.
+ */
+#define	CLEANUP_RUNS() do {						\
+    if (RunLength)							\
+	SETVAL(0);							\
+    if (a0 != lastx) {							\
+	badlength(a0, lastx);						\
+	while (a0 > lastx && pa > thisrun)				\
+	    a0 -= *--pa;						\
+	if (a0 < lastx) {						\
+	    if (a0 < 0)							\
+		a0 = 0;							\
+	    if ((pa-thisrun)&1)						\
+		SETVAL(0);						\
+	    SETVAL(lastx - a0);						\
+	} else if (a0 > lastx) {					\
+	    SETVAL(lastx);						\
+	    SETVAL(0);							\
+	}								\
+    }									\
+} while (0)
+
+/*
+ * Decode a line of 1D-encoded data.
+ *
+ * The line expanders are written as macros so that they can be reused
+ * but still have direct access to the local variables of the "calling"
+ * function.
+ *
+ * Note that unlike the original version we have to explicitly test for
+ * a0 >= lastx after each black/white run is decoded.  This is because
+ * the original code depended on the input data being zero-padded to
+ * insure the decoder recognized an EOL before running out of data.
+ */
+#define EXPAND1D(eoflab) do {						\
+    for (;;) {								\
+	for (;;) {							\
+	    LOOKUP16(12, TIFFFaxWhiteTable, eof1d);			\
+	    switch (TabEnt->State) {					\
+	    case S_EOL:							\
+		EOLcnt = 1;						\
+		goto done1d;						\
+	    case S_TermW:						\
+		SETVAL(TabEnt->Param);					\
+		goto doneWhite1d;					\
+	    case S_MakeUpW:						\
+	    case S_MakeUp:						\
+		a0 += TabEnt->Param;					\
+		RunLength += TabEnt->Param;				\
+		break;							\
+	    default:							\
+		unexpected("WhiteTable", a0);				\
+		goto done1d;						\
+	    }								\
+	}								\
+    doneWhite1d:							\
+	if (a0 >= lastx)						\
+	    goto done1d;						\
+	for (;;) {							\
+	    LOOKUP16(13, TIFFFaxBlackTable, eof1d);			\
+	    switch (TabEnt->State) {					\
+	    case S_EOL:							\
+		EOLcnt = 1;						\
+		goto done1d;						\
+	    case S_TermB:						\
+		SETVAL(TabEnt->Param);					\
+		goto doneBlack1d;					\
+	    case S_MakeUpB:						\
+	    case S_MakeUp:						\
+		a0 += TabEnt->Param;					\
+		RunLength += TabEnt->Param;				\
+		break;							\
+	    default:							\
+		unexpected("BlackTable", a0);				\
+		goto done1d;						\
+	    }								\
+	}								\
+    doneBlack1d:							\
+	if (a0 >= lastx)						\
+	    goto done1d;						\
+        if( *(pa-1) == 0 && *(pa-2) == 0 )				\
+            pa -= 2;                                                    \
+    }									\
+eof1d:									\
+    prematureEOF(a0);							\
+    CLEANUP_RUNS();							\
+    goto eoflab;							\
+done1d:									\
+    CLEANUP_RUNS();							\
+} while (0)
+
+/*
+ * Update the value of b1 using the array
+ * of runs for the reference line.
+ */
+#define CHECK_b1 do {							\
+    if (pa != thisrun) while (b1 <= a0 && b1 < lastx) {			\
+	b1 += pb[0] + pb[1];						\
+	pb += 2;							\
+    }									\
+} while (0)
+
+/*
+ * Expand a row of 2D-encoded data.
+ */
+#define EXPAND2D(eoflab) do {						\
+    while (a0 < lastx) {						\
+	LOOKUP8(7, TIFFFaxMainTable, eof2d);				\
+	switch (TabEnt->State) {					\
+	case S_Pass:							\
+	    CHECK_b1;							\
+	    b1 += *pb++;						\
+	    RunLength += b1 - a0;					\
+	    a0 = b1;							\
+	    b1 += *pb++;						\
+	    break;							\
+	case S_Horiz:							\
+	    if ((pa-thisrun)&1) {					\
+		for (;;) {	/* black first */			\
+		    LOOKUP16(13, TIFFFaxBlackTable, eof2d);		\
+		    switch (TabEnt->State) {				\
+		    case S_TermB:					\
+			SETVAL(TabEnt->Param);				\
+			goto doneWhite2da;				\
+		    case S_MakeUpB:					\
+		    case S_MakeUp:					\
+			a0 += TabEnt->Param;				\
+			RunLength += TabEnt->Param;			\
+			break;						\
+		    default:						\
+			goto badBlack2d;				\
+		    }							\
+		}							\
+	    doneWhite2da:;						\
+		for (;;) {	/* then white */			\
+		    LOOKUP16(12, TIFFFaxWhiteTable, eof2d);		\
+		    switch (TabEnt->State) {				\
+		    case S_TermW:					\
+			SETVAL(TabEnt->Param);				\
+			goto doneBlack2da;				\
+		    case S_MakeUpW:					\
+		    case S_MakeUp:					\
+			a0 += TabEnt->Param;				\
+			RunLength += TabEnt->Param;			\
+			break;						\
+		    default:						\
+			goto badWhite2d;				\
+		    }							\
+		}							\
+	    doneBlack2da:;						\
+	    } else {							\
+		for (;;) {	/* white first */			\
+		    LOOKUP16(12, TIFFFaxWhiteTable, eof2d);		\
+		    switch (TabEnt->State) {				\
+		    case S_TermW:					\
+			SETVAL(TabEnt->Param);				\
+			goto doneWhite2db;				\
+		    case S_MakeUpW:					\
+		    case S_MakeUp:					\
+			a0 += TabEnt->Param;				\
+			RunLength += TabEnt->Param;			\
+			break;						\
+		    default:						\
+			goto badWhite2d;				\
+		    }							\
+		}							\
+	    doneWhite2db:;						\
+		for (;;) {	/* then black */			\
+		    LOOKUP16(13, TIFFFaxBlackTable, eof2d);		\
+		    switch (TabEnt->State) {				\
+		    case S_TermB:					\
+			SETVAL(TabEnt->Param);				\
+			goto doneBlack2db;				\
+		    case S_MakeUpB:					\
+		    case S_MakeUp:					\
+			a0 += TabEnt->Param;				\
+			RunLength += TabEnt->Param;			\
+			break;						\
+		    default:						\
+			goto badBlack2d;				\
+		    }							\
+		}							\
+	    doneBlack2db:;						\
+	    }								\
+	    CHECK_b1;							\
+	    break;							\
+	case S_V0:							\
+	    CHECK_b1;							\
+	    SETVAL(b1 - a0);						\
+	    b1 += *pb++;						\
+	    break;							\
+	case S_VR:							\
+	    CHECK_b1;							\
+	    SETVAL(b1 - a0 + TabEnt->Param);				\
+	    b1 += *pb++;						\
+	    break;							\
+	case S_VL:							\
+	    CHECK_b1;							\
+	    SETVAL(b1 - a0 - TabEnt->Param);				\
+	    b1 -= *--pb;						\
+	    break;							\
+	case S_Ext:							\
+	    *pa++ = lastx - a0;						\
+	    extension(a0);						\
+	    goto eol2d;							\
+	case S_EOL:							\
+	    *pa++ = lastx - a0;						\
+	    NeedBits8(4,eof2d);						\
+	    if (GetBits(4))						\
+		unexpected("EOL", a0);					\
+            ClrBits(4);                                                 \
+	    EOLcnt = 1;							\
+	    goto eol2d;							\
+	default:							\
+	badMain2d:							\
+	    unexpected("MainTable", a0);				\
+	    goto eol2d;							\
+	badBlack2d:							\
+	    unexpected("BlackTable", a0);				\
+	    goto eol2d;							\
+	badWhite2d:							\
+	    unexpected("WhiteTable", a0);				\
+	    goto eol2d;							\
+	eof2d:								\
+	    prematureEOF(a0);						\
+	    CLEANUP_RUNS();						\
+	    goto eoflab;						\
+	}								\
+    }									\
+    if (RunLength) {							\
+	if (RunLength + a0 < lastx) {					\
+	    /* expect a final V0 */					\
+	    NeedBits8(1,eof2d);						\
+	    if (!GetBits(1))						\
+		goto badMain2d;						\
+	    ClrBits(1);							\
+	}								\
+	SETVAL(0);							\
+    }									\
+eol2d:									\
+    CLEANUP_RUNS();							\
+} while (0)
+#endif /* _FAX3_ */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_predict.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_predict.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/tif_predict.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,61 @@
+/* $Header: /cvsroot/osrs/libtiff/libtiff/tif_predict.h,v 1.1.1.1 1999/07/27 21:50:27 mike Exp $ */
+
+/*
+ * Copyright (c) 1995-1997 Sam Leffler
+ * Copyright (c) 1995-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _TIFFPREDICT_
+#define	_TIFFPREDICT_
+/*
+ * ``Library-private'' Support for the Predictor Tag
+ */
+
+/*
+ * Codecs that want to support the Predictor tag must place
+ * this structure first in their private state block so that
+ * the predictor code can cast tif_data to find its state.
+ */
+typedef struct {
+	int	predictor;		/* predictor tag value */
+	int	stride;			/* sample stride over data */
+	tsize_t	rowsize;		/* tile/strip row size */
+
+	TIFFPostMethod	pfunc;		/* horizontal differencer/accumulator */
+	TIFFCodeMethod	coderow;	/* parent codec encode/decode row */
+	TIFFCodeMethod	codestrip;	/* parent codec encode/decode strip */
+	TIFFCodeMethod	codetile;	/* parent codec encode/decode tile */
+	TIFFVGetMethod	vgetparent;	/* super-class method */
+	TIFFVSetMethod	vsetparent;	/* super-class method */
+	TIFFPrintMethod	printdir;	/* super-class method */
+	TIFFBoolMethod	setupdecode;	/* super-class method */
+	TIFFBoolMethod	setupencode;	/* super-class method */
+} TIFFPredictorState;
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+extern	int TIFFPredictorInit(TIFF*);
+#if defined(__cplusplus)
+}
+#endif
+#endif /* _TIFFPREDICT_ */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiff.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiff.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiff.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,647 @@
+/* $Id: tiff.h,v 1.42 2005/12/23 15:10:45 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _TIFF_
+#define	_TIFF_
+
+#include "tiffconf.h"
+
+/*
+ * Tag Image File Format (TIFF)
+ *
+ * Based on Rev 6.0 from:
+ *    Developer's Desk
+ *    Aldus Corporation
+ *    411 First Ave. South
+ *    Suite 200
+ *    Seattle, WA  98104
+ *    206-622-5500
+ *    
+ *    (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)
+ *
+ * For Big TIFF design notes see the following link
+ *    http://gdal.maptools.org/twiki/bin/view/libtiff/BigTIFFDesign
+ */
+#define	TIFF_VERSION	        42
+#define TIFF_BIGTIFF_VERSION    43
+
+#define	TIFF_BIGENDIAN		0x4d4d
+#define	TIFF_LITTLEENDIAN	0x4949
+#define	MDI_LITTLEENDIAN        0x5045
+#define	MDI_BIGENDIAN           0x4550
+/*
+ * Intrinsic data types required by the file format:
+ *
+ * 8-bit quantities	int8/uint8
+ * 16-bit quantities	int16/uint16
+ * 32-bit quantities	int32/uint32
+ * strings		unsigned char*
+ */
+
+#ifndef HAVE_INT8
+typedef	signed char int8;	/* NB: non-ANSI compilers may not grok */
+#endif
+typedef	unsigned char uint8;
+#ifndef HAVE_INT16
+typedef	short int16;
+#endif
+typedef	unsigned short uint16;	/* sizeof (uint16) must == 2 */
+#if SIZEOF_INT == 4
+#ifndef HAVE_INT32
+typedef	int int32;
+#endif
+typedef	unsigned int uint32;	/* sizeof (uint32) must == 4 */
+#elif SIZEOF_LONG == 4
+#ifndef HAVE_INT32
+typedef	long int32;
+#endif
+typedef	unsigned long uint32;	/* sizeof (uint32) must == 4 */
+#endif
+
+/* For TIFFReassignTagToIgnore */
+enum TIFFIgnoreSense /* IGNORE tag table */
+{
+	TIS_STORE,
+	TIS_EXTRACT,
+	TIS_EMPTY
+};
+
+/*
+ * TIFF header.
+ */
+typedef	struct {
+	uint16	tiff_magic;	/* magic number (defines byte order) */
+#define TIFF_MAGIC_SIZE		2
+	uint16	tiff_version;	/* TIFF version number */
+#define TIFF_VERSION_SIZE	2
+	uint32	tiff_diroff;	/* byte offset to first directory */
+#define TIFF_DIROFFSET_SIZE	4
+} TIFFHeader;
+
+
+/*
+ * TIFF Image File Directories are comprised of a table of field
+ * descriptors of the form shown below.  The table is sorted in
+ * ascending order by tag.  The values associated with each entry are
+ * disjoint and may appear anywhere in the file (so long as they are
+ * placed on a word boundary).
+ *
+ * If the value is 4 bytes or less, then it is placed in the offset
+ * field to save space.  If the value is less than 4 bytes, it is
+ * left-justified in the offset field.
+ */
+typedef	struct {
+	uint16		tdir_tag;	/* see below */
+	uint16		tdir_type;	/* data type; see below */
+	uint32		tdir_count;	/* number of items; length in spec */
+	uint32		tdir_offset;	/* byte offset to field data */
+} TIFFDirEntry;
+
+/*
+ * NB: In the comments below,
+ *  - items marked with a + are obsoleted by revision 5.0,
+ *  - items marked with a ! are introduced in revision 6.0.
+ *  - items marked with a % are introduced post revision 6.0.
+ *  - items marked with a $ are obsoleted by revision 6.0.
+ *  - items marked with a & are introduced by Adobe DNG specification.
+ */
+
+/*
+ * Tag data type information.
+ *
+ * Note: RATIONALs are the ratio of two 32-bit integer values.
+ */
+typedef	enum {
+	TIFF_NOTYPE	= 0,	/* placeholder */
+	TIFF_BYTE	= 1,	/* 8-bit unsigned integer */
+	TIFF_ASCII	= 2,	/* 8-bit bytes w/ last byte null */
+	TIFF_SHORT	= 3,	/* 16-bit unsigned integer */
+	TIFF_LONG	= 4,	/* 32-bit unsigned integer */
+	TIFF_RATIONAL	= 5,	/* 64-bit unsigned fraction */
+	TIFF_SBYTE	= 6,	/* !8-bit signed integer */
+	TIFF_UNDEFINED	= 7,	/* !8-bit untyped data */
+	TIFF_SSHORT	= 8,	/* !16-bit signed integer */
+	TIFF_SLONG	= 9,	/* !32-bit signed integer */
+	TIFF_SRATIONAL	= 10,	/* !64-bit signed fraction */
+	TIFF_FLOAT	= 11,	/* !32-bit IEEE floating point */
+	TIFF_DOUBLE	= 12,	/* !64-bit IEEE floating point */
+	TIFF_IFD	= 13	/* %32-bit unsigned integer (offset) */
+} TIFFDataType;
+
+/*
+ * TIFF Tag Definitions.
+ */
+#define	TIFFTAG_SUBFILETYPE		254	/* subfile data descriptor */
+#define	    FILETYPE_REDUCEDIMAGE	0x1	/* reduced resolution version */
+#define	    FILETYPE_PAGE		0x2	/* one page of many */
+#define	    FILETYPE_MASK		0x4	/* transparency mask */
+#define	TIFFTAG_OSUBFILETYPE		255	/* +kind of data in subfile */
+#define	    OFILETYPE_IMAGE		1	/* full resolution image data */
+#define	    OFILETYPE_REDUCEDIMAGE	2	/* reduced size image data */
+#define	    OFILETYPE_PAGE		3	/* one page of many */
+#define	TIFFTAG_IMAGEWIDTH		256	/* image width in pixels */
+#define	TIFFTAG_IMAGELENGTH		257	/* image height in pixels */
+#define	TIFFTAG_BITSPERSAMPLE		258	/* bits per channel (sample) */
+#define	TIFFTAG_COMPRESSION		259	/* data compression technique */
+#define	    COMPRESSION_NONE		1	/* dump mode */
+#define	    COMPRESSION_CCITTRLE	2	/* CCITT modified Huffman RLE */
+#define	    COMPRESSION_CCITTFAX3	3	/* CCITT Group 3 fax encoding */
+#define     COMPRESSION_CCITT_T4        3       /* CCITT T.4 (TIFF 6 name) */
+#define	    COMPRESSION_CCITTFAX4	4	/* CCITT Group 4 fax encoding */
+#define     COMPRESSION_CCITT_T6        4       /* CCITT T.6 (TIFF 6 name) */
+#define	    COMPRESSION_LZW		5       /* Lempel-Ziv  & Welch */
+#define	    COMPRESSION_OJPEG		6	/* !6.0 JPEG */
+#define	    COMPRESSION_JPEG		7	/* %JPEG DCT compression */
+#define	    COMPRESSION_NEXT		32766	/* NeXT 2-bit RLE */
+#define	    COMPRESSION_CCITTRLEW	32771	/* #1 w/ word alignment */
+#define	    COMPRESSION_PACKBITS	32773	/* Macintosh RLE */
+#define	    COMPRESSION_THUNDERSCAN	32809	/* ThunderScan RLE */
+/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly at apago.com) */
+#define	    COMPRESSION_IT8CTPAD	32895   /* IT8 CT w/padding */
+#define	    COMPRESSION_IT8LW		32896   /* IT8 Linework RLE */
+#define	    COMPRESSION_IT8MP		32897   /* IT8 Monochrome picture */
+#define	    COMPRESSION_IT8BL		32898   /* IT8 Binary line art */
+/* compression codes 32908-32911 are reserved for Pixar */
+#define     COMPRESSION_PIXARFILM	32908   /* Pixar companded 10bit LZW */
+#define	    COMPRESSION_PIXARLOG	32909   /* Pixar companded 11bit ZIP */
+#define	    COMPRESSION_DEFLATE		32946	/* Deflate compression */
+#define     COMPRESSION_ADOBE_DEFLATE   8       /* Deflate compression,
+						   as recognized by Adobe */
+/* compression code 32947 is reserved for Oceana Matrix <dev at oceana.com> */
+#define     COMPRESSION_DCS             32947   /* Kodak DCS encoding */
+#define	    COMPRESSION_JBIG		34661	/* ISO JBIG */
+#define     COMPRESSION_SGILOG		34676	/* SGI Log Luminance RLE */
+#define     COMPRESSION_SGILOG24	34677	/* SGI Log 24-bit packed */
+#define     COMPRESSION_JP2000          34712   /* Leadtools JPEG2000 */
+#define	TIFFTAG_PHOTOMETRIC		262	/* photometric interpretation */
+#define	    PHOTOMETRIC_MINISWHITE	0	/* min value is white */
+#define	    PHOTOMETRIC_MINISBLACK	1	/* min value is black */
+#define	    PHOTOMETRIC_RGB		2	/* RGB color model */
+#define	    PHOTOMETRIC_PALETTE		3	/* color map indexed */
+#define	    PHOTOMETRIC_MASK		4	/* $holdout mask */
+#define	    PHOTOMETRIC_SEPARATED	5	/* !color separations */
+#define	    PHOTOMETRIC_YCBCR		6	/* !CCIR 601 */
+#define	    PHOTOMETRIC_CIELAB		8	/* !1976 CIE L*a*b* */
+#define	    PHOTOMETRIC_ICCLAB		9	/* ICC L*a*b* [Adobe TIFF Technote 4] */
+#define	    PHOTOMETRIC_ITULAB		10	/* ITU L*a*b* */
+#define     PHOTOMETRIC_LOGL		32844	/* CIE Log2(L) */
+#define     PHOTOMETRIC_LOGLUV		32845	/* CIE Log2(L) (u',v') */
+#define	TIFFTAG_THRESHHOLDING		263	/* +thresholding used on data */
+#define	    THRESHHOLD_BILEVEL		1	/* b&w art scan */
+#define	    THRESHHOLD_HALFTONE		2	/* or dithered scan */
+#define	    THRESHHOLD_ERRORDIFFUSE	3	/* usually floyd-steinberg */
+#define	TIFFTAG_CELLWIDTH		264	/* +dithering matrix width */
+#define	TIFFTAG_CELLLENGTH		265	/* +dithering matrix height */
+#define	TIFFTAG_FILLORDER		266	/* data order within a byte */
+#define	    FILLORDER_MSB2LSB		1	/* most significant -> least */
+#define	    FILLORDER_LSB2MSB		2	/* least significant -> most */
+#define	TIFFTAG_DOCUMENTNAME		269	/* name of doc. image is from */
+#define	TIFFTAG_IMAGEDESCRIPTION	270	/* info about image */
+#define	TIFFTAG_MAKE			271	/* scanner manufacturer name */
+#define	TIFFTAG_MODEL			272	/* scanner model name/number */
+#define	TIFFTAG_STRIPOFFSETS		273	/* offsets to data strips */
+#define	TIFFTAG_ORIENTATION		274	/* +image orientation */
+#define	    ORIENTATION_TOPLEFT		1	/* row 0 top, col 0 lhs */
+#define	    ORIENTATION_TOPRIGHT	2	/* row 0 top, col 0 rhs */
+#define	    ORIENTATION_BOTRIGHT	3	/* row 0 bottom, col 0 rhs */
+#define	    ORIENTATION_BOTLEFT		4	/* row 0 bottom, col 0 lhs */
+#define	    ORIENTATION_LEFTTOP		5	/* row 0 lhs, col 0 top */
+#define	    ORIENTATION_RIGHTTOP	6	/* row 0 rhs, col 0 top */
+#define	    ORIENTATION_RIGHTBOT	7	/* row 0 rhs, col 0 bottom */
+#define	    ORIENTATION_LEFTBOT		8	/* row 0 lhs, col 0 bottom */
+#define	TIFFTAG_SAMPLESPERPIXEL		277	/* samples per pixel */
+#define	TIFFTAG_ROWSPERSTRIP		278	/* rows per strip of data */
+#define	TIFFTAG_STRIPBYTECOUNTS		279	/* bytes counts for strips */
+#define	TIFFTAG_MINSAMPLEVALUE		280	/* +minimum sample value */
+#define	TIFFTAG_MAXSAMPLEVALUE		281	/* +maximum sample value */
+#define	TIFFTAG_XRESOLUTION		282	/* pixels/resolution in x */
+#define	TIFFTAG_YRESOLUTION		283	/* pixels/resolution in y */
+#define	TIFFTAG_PLANARCONFIG		284	/* storage organization */
+#define	    PLANARCONFIG_CONTIG		1	/* single image plane */
+#define	    PLANARCONFIG_SEPARATE	2	/* separate planes of data */
+#define	TIFFTAG_PAGENAME		285	/* page name image is from */
+#define	TIFFTAG_XPOSITION		286	/* x page offset of image lhs */
+#define	TIFFTAG_YPOSITION		287	/* y page offset of image lhs */
+#define	TIFFTAG_FREEOFFSETS		288	/* +byte offset to free block */
+#define	TIFFTAG_FREEBYTECOUNTS		289	/* +sizes of free blocks */
+#define	TIFFTAG_GRAYRESPONSEUNIT	290	/* $gray scale curve accuracy */
+#define	    GRAYRESPONSEUNIT_10S	1	/* tenths of a unit */
+#define	    GRAYRESPONSEUNIT_100S	2	/* hundredths of a unit */
+#define	    GRAYRESPONSEUNIT_1000S	3	/* thousandths of a unit */
+#define	    GRAYRESPONSEUNIT_10000S	4	/* ten-thousandths of a unit */
+#define	    GRAYRESPONSEUNIT_100000S	5	/* hundred-thousandths */
+#define	TIFFTAG_GRAYRESPONSECURVE	291	/* $gray scale response curve */
+#define	TIFFTAG_GROUP3OPTIONS		292	/* 32 flag bits */
+#define	TIFFTAG_T4OPTIONS		292	/* TIFF 6.0 proper name alias */
+#define	    GROUP3OPT_2DENCODING	0x1	/* 2-dimensional coding */
+#define	    GROUP3OPT_UNCOMPRESSED	0x2	/* data not compressed */
+#define	    GROUP3OPT_FILLBITS		0x4	/* fill to byte boundary */
+#define	TIFFTAG_GROUP4OPTIONS		293	/* 32 flag bits */
+#define TIFFTAG_T6OPTIONS               293     /* TIFF 6.0 proper name */
+#define	    GROUP4OPT_UNCOMPRESSED	0x2	/* data not compressed */
+#define	TIFFTAG_RESOLUTIONUNIT		296	/* units of resolutions */
+#define	    RESUNIT_NONE		1	/* no meaningful units */
+#define	    RESUNIT_INCH		2	/* english */
+#define	    RESUNIT_CENTIMETER		3	/* metric */
+#define	TIFFTAG_PAGENUMBER		297	/* page numbers of multi-page */
+#define	TIFFTAG_COLORRESPONSEUNIT	300	/* $color curve accuracy */
+#define	    COLORRESPONSEUNIT_10S	1	/* tenths of a unit */
+#define	    COLORRESPONSEUNIT_100S	2	/* hundredths of a unit */
+#define	    COLORRESPONSEUNIT_1000S	3	/* thousandths of a unit */
+#define	    COLORRESPONSEUNIT_10000S	4	/* ten-thousandths of a unit */
+#define	    COLORRESPONSEUNIT_100000S	5	/* hundred-thousandths */
+#define	TIFFTAG_TRANSFERFUNCTION	301	/* !colorimetry info */
+#define	TIFFTAG_SOFTWARE		305	/* name & release */
+#define	TIFFTAG_DATETIME		306	/* creation date and time */
+#define	TIFFTAG_ARTIST			315	/* creator of image */
+#define	TIFFTAG_HOSTCOMPUTER		316	/* machine where created */
+#define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
+#define     PREDICTOR_NONE		1	/* no prediction scheme used */
+#define     PREDICTOR_HORIZONTAL	2	/* horizontal differencing */
+#define     PREDICTOR_FLOATINGPOINT	3	/* floating point predictor */
+#define	TIFFTAG_WHITEPOINT		318	/* image white point */
+#define	TIFFTAG_PRIMARYCHROMATICITIES	319	/* !primary chromaticities */
+#define	TIFFTAG_COLORMAP		320	/* RGB map for pallette image */
+#define	TIFFTAG_HALFTONEHINTS		321	/* !highlight+shadow info */
+#define	TIFFTAG_TILEWIDTH		322	/* !tile width in pixels */
+#define	TIFFTAG_TILELENGTH		323	/* !tile height in pixels */
+#define TIFFTAG_TILEOFFSETS		324	/* !offsets to data tiles */
+#define TIFFTAG_TILEBYTECOUNTS		325	/* !byte counts for tiles */
+#define	TIFFTAG_BADFAXLINES		326	/* lines w/ wrong pixel count */
+#define	TIFFTAG_CLEANFAXDATA		327	/* regenerated line info */
+#define	    CLEANFAXDATA_CLEAN		0	/* no errors detected */
+#define	    CLEANFAXDATA_REGENERATED	1	/* receiver regenerated lines */
+#define	    CLEANFAXDATA_UNCLEAN	2	/* uncorrected errors exist */
+#define	TIFFTAG_CONSECUTIVEBADFAXLINES	328	/* max consecutive bad lines */
+#define	TIFFTAG_SUBIFD			330	/* subimage descriptors */
+#define	TIFFTAG_INKSET			332	/* !inks in separated image */
+#define	    INKSET_CMYK			1	/* !cyan-magenta-yellow-black color */
+#define	    INKSET_MULTIINK		2	/* !multi-ink or hi-fi color */
+#define	TIFFTAG_INKNAMES		333	/* !ascii names of inks */
+#define	TIFFTAG_NUMBEROFINKS		334	/* !number of inks */
+#define	TIFFTAG_DOTRANGE		336	/* !0% and 100% dot codes */
+#define	TIFFTAG_TARGETPRINTER		337	/* !separation target */
+#define	TIFFTAG_EXTRASAMPLES		338	/* !info about extra samples */
+#define	    EXTRASAMPLE_UNSPECIFIED	0	/* !unspecified data */
+#define	    EXTRASAMPLE_ASSOCALPHA	1	/* !associated alpha data */
+#define	    EXTRASAMPLE_UNASSALPHA	2	/* !unassociated alpha data */
+#define	TIFFTAG_SAMPLEFORMAT		339	/* !data sample format */
+#define	    SAMPLEFORMAT_UINT		1	/* !unsigned integer data */
+#define	    SAMPLEFORMAT_INT		2	/* !signed integer data */
+#define	    SAMPLEFORMAT_IEEEFP		3	/* !IEEE floating point data */
+#define	    SAMPLEFORMAT_VOID		4	/* !untyped data */
+#define	    SAMPLEFORMAT_COMPLEXINT	5	/* !complex signed int */
+#define	    SAMPLEFORMAT_COMPLEXIEEEFP	6	/* !complex ieee floating */
+#define	TIFFTAG_SMINSAMPLEVALUE		340	/* !variable MinSampleValue */
+#define	TIFFTAG_SMAXSAMPLEVALUE		341	/* !variable MaxSampleValue */
+#define	TIFFTAG_CLIPPATH		343	/* %ClipPath
+						   [Adobe TIFF technote 2] */
+#define	TIFFTAG_XCLIPPATHUNITS		344	/* %XClipPathUnits
+						   [Adobe TIFF technote 2] */
+#define	TIFFTAG_YCLIPPATHUNITS		345	/* %YClipPathUnits
+						   [Adobe TIFF technote 2] */
+#define	TIFFTAG_INDEXED			346	/* %Indexed
+						   [Adobe TIFF Technote 3] */
+#define	TIFFTAG_JPEGTABLES		347	/* %JPEG table stream */
+#define	TIFFTAG_OPIPROXY		351	/* %OPI Proxy [Adobe TIFF technote] */
+/*
+ * Tags 512-521 are obsoleted by Technical Note #2 which specifies a
+ * revised JPEG-in-TIFF scheme.
+ */
+#define	TIFFTAG_JPEGPROC		512	/* !JPEG processing algorithm */
+#define	    JPEGPROC_BASELINE		1	/* !baseline sequential */
+#define	    JPEGPROC_LOSSLESS		14	/* !Huffman coded lossless */
+#define	TIFFTAG_JPEGIFOFFSET		513	/* !pointer to SOI marker */
+#define	TIFFTAG_JPEGIFBYTECOUNT		514	/* !JFIF stream length */
+#define	TIFFTAG_JPEGRESTARTINTERVAL	515	/* !restart interval length */
+#define	TIFFTAG_JPEGLOSSLESSPREDICTORS	517	/* !lossless proc predictor */
+#define	TIFFTAG_JPEGPOINTTRANSFORM	518	/* !lossless point transform */
+#define	TIFFTAG_JPEGQTABLES		519	/* !Q matrice offsets */
+#define	TIFFTAG_JPEGDCTABLES		520	/* !DCT table offsets */
+#define	TIFFTAG_JPEGACTABLES		521	/* !AC coefficient offsets */
+#define	TIFFTAG_YCBCRCOEFFICIENTS	529	/* !RGB -> YCbCr transform */
+#define	TIFFTAG_YCBCRSUBSAMPLING	530	/* !YCbCr subsampling factors */
+#define	TIFFTAG_YCBCRPOSITIONING	531	/* !subsample positioning */
+#define	    YCBCRPOSITION_CENTERED	1	/* !as in PostScript Level 2 */
+#define	    YCBCRPOSITION_COSITED	2	/* !as in CCIR 601-1 */
+#define	TIFFTAG_REFERENCEBLACKWHITE	532	/* !colorimetry info */
+#define	TIFFTAG_XMLPACKET		700	/* %XML packet
+						   [Adobe XMP Specification,
+						   January 2004 */
+#define TIFFTAG_OPIIMAGEID		32781	/* %OPI ImageID
+						   [Adobe TIFF technote] */
+/* tags 32952-32956 are private tags registered to Island Graphics */
+#define TIFFTAG_REFPTS			32953	/* image reference points */
+#define TIFFTAG_REGIONTACKPOINT		32954	/* region-xform tack point */
+#define TIFFTAG_REGIONWARPCORNERS	32955	/* warp quadrilateral */
+#define TIFFTAG_REGIONAFFINE		32956	/* affine transformation mat */
+/* tags 32995-32999 are private tags registered to SGI */
+#define	TIFFTAG_MATTEING		32995	/* $use ExtraSamples */
+#define	TIFFTAG_DATATYPE		32996	/* $use SampleFormat */
+#define	TIFFTAG_IMAGEDEPTH		32997	/* z depth of image */
+#define	TIFFTAG_TILEDEPTH		32998	/* z depth/data tile */
+/* tags 33300-33309 are private tags registered to Pixar */
+/*
+ * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH
+ * are set when an image has been cropped out of a larger image.  
+ * They reflect the size of the original uncropped image.
+ * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used
+ * to determine the position of the smaller image in the larger one.
+ */
+#define TIFFTAG_PIXAR_IMAGEFULLWIDTH    33300   /* full image size in x */
+#define TIFFTAG_PIXAR_IMAGEFULLLENGTH   33301   /* full image size in y */
+ /* Tags 33302-33306 are used to identify special image modes and data
+  * used by Pixar's texture formats.
+  */
+#define TIFFTAG_PIXAR_TEXTUREFORMAT	33302	/* texture map format */
+#define TIFFTAG_PIXAR_WRAPMODES		33303	/* s & t wrap modes */
+#define TIFFTAG_PIXAR_FOVCOT		33304	/* cotan(fov) for env. maps */
+#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305
+#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
+/* tag 33405 is a private tag registered to Eastman Kodak */
+#define TIFFTAG_WRITERSERIALNUMBER      33405   /* device serial number */
+/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
+#define	TIFFTAG_COPYRIGHT		33432	/* copyright string */
+/* IPTC TAG from RichTIFF specifications */
+#define TIFFTAG_RICHTIFFIPTC		33723
+/* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly at apago.com) */
+#define TIFFTAG_IT8SITE			34016	/* site name */
+#define TIFFTAG_IT8COLORSEQUENCE	34017	/* color seq. [RGB,CMYK,etc] */
+#define TIFFTAG_IT8HEADER		34018	/* DDES Header */
+#define TIFFTAG_IT8RASTERPADDING	34019	/* raster scanline padding */
+#define TIFFTAG_IT8BITSPERRUNLENGTH	34020	/* # of bits in short run */
+#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */
+#define TIFFTAG_IT8COLORTABLE		34022	/* LW colortable */
+#define TIFFTAG_IT8IMAGECOLORINDICATOR	34023	/* BP/BL image color switch */
+#define TIFFTAG_IT8BKGCOLORINDICATOR	34024	/* BP/BL bg color switch */
+#define TIFFTAG_IT8IMAGECOLORVALUE	34025	/* BP/BL image color value */
+#define TIFFTAG_IT8BKGCOLORVALUE	34026	/* BP/BL bg color value */
+#define TIFFTAG_IT8PIXELINTENSITYRANGE	34027	/* MP pixel intensity value */
+#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028	/* HC transparency switch */
+#define TIFFTAG_IT8COLORCHARACTERIZATION 34029	/* color character. table */
+#define TIFFTAG_IT8HCUSAGE		34030	/* HC usage indicator */
+#define TIFFTAG_IT8TRAPINDICATOR	34031	/* Trapping indicator
+						   (untrapped=0, trapped=1) */
+#define TIFFTAG_IT8CMYKEQUIVALENT	34032	/* CMYK color equivalents */
+/* tags 34232-34236 are private tags registered to Texas Instruments */
+#define TIFFTAG_FRAMECOUNT              34232   /* Sequence Frame Count */
+/* tag 34377 is private tag registered to Adobe for PhotoShop */
+#define TIFFTAG_PHOTOSHOP		34377 
+/* tags 34665, 34853 and 40965 are documented in EXIF specification */
+#define TIFFTAG_EXIFIFD			34665	/* Pointer to EXIF private directory */
+/* tag 34750 is a private tag registered to Adobe? */
+#define TIFFTAG_ICCPROFILE		34675	/* ICC profile data */
+/* tag 34750 is a private tag registered to Pixel Magic */
+#define	TIFFTAG_JBIGOPTIONS		34750	/* JBIG options */
+#define TIFFTAG_GPSIFD			34853	/* Pointer to GPS private directory */
+/* tags 34908-34914 are private tags registered to SGI */
+#define	TIFFTAG_FAXRECVPARAMS		34908	/* encoded Class 2 ses. parms */
+#define	TIFFTAG_FAXSUBADDRESS		34909	/* received SubAddr string */
+#define	TIFFTAG_FAXRECVTIME		34910	/* receive time (secs) */
+#define	TIFFTAG_FAXDCS			34911	/* encoded fax ses. params, Table 2/T.30 */
+/* tags 37439-37443 are registered to SGI <gregl at sgi.com> */
+#define TIFFTAG_STONITS			37439	/* Sample value to Nits */
+/* tag 34929 is a private tag registered to FedEx */
+#define	TIFFTAG_FEDEX_EDR		34929	/* unknown use */
+#define TIFFTAG_INTEROPERABILITYIFD	40965	/* Pointer to Interoperability private directory */
+/* Adobe Digital Negative (DNG) format tags */
+#define TIFFTAG_DNGVERSION		50706	/* &DNG version number */
+#define TIFFTAG_DNGBACKWARDVERSION	50707	/* &DNG compatibility version */
+#define TIFFTAG_UNIQUECAMERAMODEL	50708	/* &name for the camera model */
+#define TIFFTAG_LOCALIZEDCAMERAMODEL	50709	/* &localized camera model
+						   name */
+#define TIFFTAG_CFAPLANECOLOR		50710	/* &CFAPattern->LinearRaw space
+						   mapping */
+#define TIFFTAG_CFALAYOUT		50711	/* &spatial layout of the CFA */
+#define TIFFTAG_LINEARIZATIONTABLE	50712	/* &lookup table description */
+#define TIFFTAG_BLACKLEVELREPEATDIM	50713	/* &repeat pattern size for
+						   the BlackLevel tag */
+#define TIFFTAG_BLACKLEVEL		50714	/* &zero light encoding level */
+#define TIFFTAG_BLACKLEVELDELTAH	50715	/* &zero light encoding level
+						   differences (columns) */
+#define TIFFTAG_BLACKLEVELDELTAV	50716	/* &zero light encoding level
+						   differences (rows) */
+#define TIFFTAG_WHITELEVEL		50717	/* &fully saturated encoding
+						   level */
+#define TIFFTAG_DEFAULTSCALE		50718	/* &default scale factors */
+#define TIFFTAG_DEFAULTCROPORIGIN	50719	/* &origin of the final image
+						   area */
+#define TIFFTAG_DEFAULTCROPSIZE		50720	/* &size of the final image 
+						   area */
+#define TIFFTAG_COLORMATRIX1		50721	/* &XYZ->reference color space
+						   transformation matrix 1 */
+#define TIFFTAG_COLORMATRIX2		50722	/* &XYZ->reference color space
+						   transformation matrix 2 */
+#define TIFFTAG_CAMERACALIBRATION1	50723	/* &calibration matrix 1 */
+#define TIFFTAG_CAMERACALIBRATION2	50724	/* &calibration matrix 2 */
+#define TIFFTAG_REDUCTIONMATRIX1	50725	/* &dimensionality reduction
+						   matrix 1 */
+#define TIFFTAG_REDUCTIONMATRIX2	50726	/* &dimensionality reduction
+						   matrix 2 */
+#define TIFFTAG_ANALOGBALANCE		50727	/* &gain applied the stored raw
+						   values*/
+#define TIFFTAG_ASSHOTNEUTRAL		50728	/* &selected white balance in
+						   linear reference space */
+#define TIFFTAG_ASSHOTWHITEXY		50729	/* &selected white balance in
+						   x-y chromaticity
+						   coordinates */
+#define TIFFTAG_BASELINEEXPOSURE	50730	/* &how much to move the zero
+						   point */
+#define TIFFTAG_BASELINENOISE		50731	/* &relative noise level */
+#define TIFFTAG_BASELINESHARPNESS	50732	/* &relative amount of
+						   sharpening */
+#define TIFFTAG_BAYERGREENSPLIT		50733	/* &how closely the values of
+						   the green pixels in the
+						   blue/green rows track the
+						   values of the green pixels
+						   in the red/green rows */
+#define TIFFTAG_LINEARRESPONSELIMIT	50734	/* &non-linear encoding range */
+#define TIFFTAG_CAMERASERIALNUMBER	50735	/* &camera's serial number */
+#define TIFFTAG_LENSINFO		50736	/* info about the lens */
+#define TIFFTAG_CHROMABLURRADIUS	50737	/* &chroma blur radius */
+#define TIFFTAG_ANTIALIASSTRENGTH	50738	/* &relative strength of the
+						   camera's anti-alias filter */
+#define TIFFTAG_SHADOWSCALE		50739	/* &used by Adobe Camera Raw */
+#define TIFFTAG_DNGPRIVATEDATA		50740	/* &manufacturer's private data */
+#define TIFFTAG_MAKERNOTESAFETY		50741	/* &whether the EXIF MakerNote
+						   tag is safe to preserve
+						   along with the rest of the
+						   EXIF data */
+#define	TIFFTAG_CALIBRATIONILLUMINANT1	50778	/* &illuminant 1 */
+#define TIFFTAG_CALIBRATIONILLUMINANT2	50779	/* &illuminant 2 */
+#define TIFFTAG_BESTQUALITYSCALE	50780	/* &best quality multiplier */
+#define TIFFTAG_RAWDATAUNIQUEID		50781	/* &unique identifier for
+						   the raw image data */
+#define TIFFTAG_ORIGINALRAWFILENAME	50827	/* &file name of the original
+						   raw file */
+#define TIFFTAG_ORIGINALRAWFILEDATA	50828	/* &contents of the original
+						   raw file */
+#define TIFFTAG_ACTIVEAREA		50829	/* &active (non-masked) pixels
+						   of the sensor */
+#define TIFFTAG_MASKEDAREAS		50830	/* &list of coordinates
+						   of fully masked pixels */
+#define TIFFTAG_ASSHOTICCPROFILE	50831	/* &these two tags used to */
+#define TIFFTAG_ASSHOTPREPROFILEMATRIX	50832	/* map cameras's color space
+						   into ICC profile space */
+#define TIFFTAG_CURRENTICCPROFILE	50833	/* & */
+#define TIFFTAG_CURRENTPREPROFILEMATRIX	50834	/* & */
+/* tag 65535 is an undefined tag used by Eastman Kodak */
+#define TIFFTAG_DCSHUESHIFTVALUES       65535   /* hue shift correction data */
+
+/*
+ * The following are ``pseudo tags'' that can be used to control
+ * codec-specific functionality.  These tags are not written to file.
+ * Note that these values start at 0xffff+1 so that they'll never
+ * collide with Aldus-assigned tags.
+ *
+ * If you want your private pseudo tags ``registered'' (i.e. added to
+ * this file), please post a bug report via the tracking system at
+ * http://www.remotesensing.org/libtiff/bugs.html with the appropriate
+ * C definitions to add.
+ */
+#define	TIFFTAG_FAXMODE			65536	/* Group 3/4 format control */
+#define	    FAXMODE_CLASSIC	0x0000		/* default, include RTC */
+#define	    FAXMODE_NORTC	0x0001		/* no RTC at end of data */
+#define	    FAXMODE_NOEOL	0x0002		/* no EOL code at end of row */
+#define	    FAXMODE_BYTEALIGN	0x0004		/* byte align row */
+#define	    FAXMODE_WORDALIGN	0x0008		/* word align row */
+#define	    FAXMODE_CLASSF	FAXMODE_NORTC	/* TIFF Class F */
+#define	TIFFTAG_JPEGQUALITY		65537	/* Compression quality level */
+/* Note: quality level is on the IJG 0-100 scale.  Default value is 75 */
+#define	TIFFTAG_JPEGCOLORMODE		65538	/* Auto RGB<=>YCbCr convert? */
+#define	    JPEGCOLORMODE_RAW	0x0000		/* no conversion (default) */
+#define	    JPEGCOLORMODE_RGB	0x0001		/* do auto conversion */
+#define	TIFFTAG_JPEGTABLESMODE		65539	/* What to put in JPEGTables */
+#define	    JPEGTABLESMODE_QUANT 0x0001		/* include quantization tbls */
+#define	    JPEGTABLESMODE_HUFF	0x0002		/* include Huffman tbls */
+/* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */
+#define	TIFFTAG_FAXFILLFUNC		65540	/* G3/G4 fill function */
+#define	TIFFTAG_PIXARLOGDATAFMT		65549	/* PixarLogCodec I/O data sz */
+#define	    PIXARLOGDATAFMT_8BIT	0	/* regular u_char samples */
+#define	    PIXARLOGDATAFMT_8BITABGR	1	/* ABGR-order u_chars */
+#define	    PIXARLOGDATAFMT_11BITLOG	2	/* 11-bit log-encoded (raw) */
+#define	    PIXARLOGDATAFMT_12BITPICIO	3	/* as per PICIO (1.0==2048) */
+#define	    PIXARLOGDATAFMT_16BIT	4	/* signed short samples */
+#define	    PIXARLOGDATAFMT_FLOAT	5	/* IEEE float samples */
+/* 65550-65556 are allocated to Oceana Matrix <dev at oceana.com> */
+#define TIFFTAG_DCSIMAGERTYPE           65550   /* imager model & filter */
+#define     DCSIMAGERMODEL_M3           0       /* M3 chip (1280 x 1024) */
+#define     DCSIMAGERMODEL_M5           1       /* M5 chip (1536 x 1024) */
+#define     DCSIMAGERMODEL_M6           2       /* M6 chip (3072 x 2048) */
+#define     DCSIMAGERFILTER_IR          0       /* infrared filter */
+#define     DCSIMAGERFILTER_MONO        1       /* monochrome filter */
+#define     DCSIMAGERFILTER_CFA         2       /* color filter array */
+#define     DCSIMAGERFILTER_OTHER       3       /* other filter */
+#define TIFFTAG_DCSINTERPMODE           65551   /* interpolation mode */
+#define     DCSINTERPMODE_NORMAL        0x0     /* whole image, default */
+#define     DCSINTERPMODE_PREVIEW       0x1     /* preview of image (384x256) */
+#define TIFFTAG_DCSBALANCEARRAY         65552   /* color balance values */
+#define TIFFTAG_DCSCORRECTMATRIX        65553   /* color correction values */
+#define TIFFTAG_DCSGAMMA                65554   /* gamma value */
+#define TIFFTAG_DCSTOESHOULDERPTS       65555   /* toe & shoulder points */
+#define TIFFTAG_DCSCALIBRATIONFD        65556   /* calibration file desc */
+/* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */
+#define	TIFFTAG_ZIPQUALITY		65557	/* compression quality level */
+#define	TIFFTAG_PIXARLOGQUALITY		65558	/* PixarLog uses same scale */
+/* 65559 is allocated to Oceana Matrix <dev at oceana.com> */
+#define TIFFTAG_DCSCLIPRECTANGLE	65559	/* area of image to acquire */
+#define TIFFTAG_SGILOGDATAFMT		65560	/* SGILog user data format */
+#define     SGILOGDATAFMT_FLOAT		0	/* IEEE float samples */
+#define     SGILOGDATAFMT_16BIT		1	/* 16-bit samples */
+#define     SGILOGDATAFMT_RAW		2	/* uninterpreted data */
+#define     SGILOGDATAFMT_8BIT		3	/* 8-bit RGB monitor values */
+#define TIFFTAG_SGILOGENCODE		65561 /* SGILog data encoding control*/
+#define     SGILOGENCODE_NODITHER	0     /* do not dither encoded values*/
+#define     SGILOGENCODE_RANDITHER	1     /* randomly dither encd values */
+
+/*
+ * EXIF tags
+ */
+#define EXIFTAG_EXPOSURETIME		33434	/* Exposure time */
+#define EXIFTAG_FNUMBER			33437	/* F number */
+#define EXIFTAG_EXPOSUREPROGRAM		34850	/* Exposure program */
+#define EXIFTAG_SPECTRALSENSITIVITY	34852	/* Spectral sensitivity */
+#define EXIFTAG_ISOSPEEDRATINGS		34855	/* ISO speed rating */
+#define EXIFTAG_OECF			34856	/* Optoelectric conversion
+						   factor */
+#define EXIFTAG_EXIFVERSION		36864	/* Exif version */
+#define EXIFTAG_DATETIMEORIGINAL	36867	/* Date and time of original
+						   data generation */
+#define EXIFTAG_DATETIMEDIGITIZED	36868	/* Date and time of digital
+						   data generation */
+#define EXIFTAG_COMPONENTSCONFIGURATION	37121	/* Meaning of each component */
+#define EXIFTAG_COMPRESSEDBITSPERPIXEL	37122	/* Image compression mode */
+#define EXIFTAG_SHUTTERSPEEDVALUE	37377	/* Shutter speed */
+#define EXIFTAG_APERTUREVALUE		37378	/* Aperture */
+#define EXIFTAG_BRIGHTNESSVALUE		37379	/* Brightness */
+#define EXIFTAG_EXPOSUREBIASVALUE	37380	/* Exposure bias */
+#define EXIFTAG_MAXAPERTUREVALUE	37381	/* Maximum lens aperture */
+#define EXIFTAG_SUBJECTDISTANCE		37382	/* Subject distance */
+#define EXIFTAG_METERINGMODE		37383	/* Metering mode */
+#define EXIFTAG_LIGHTSOURCE		37384	/* Light source */
+#define EXIFTAG_FLASH			37385	/* Flash */
+#define EXIFTAG_FOCALLENGTH		37386	/* Lens focal length */
+#define EXIFTAG_SUBJECTAREA		37396	/* Subject area */
+#define EXIFTAG_MAKERNOTE		37500	/* Manufacturer notes */
+#define EXIFTAG_USERCOMMENT		37510	/* User comments */
+#define EXIFTAG_SUBSECTIME		37520	/* DateTime subseconds */
+#define EXIFTAG_SUBSECTIMEORIGINAL	37521	/* DateTimeOriginal subseconds */
+#define EXIFTAG_SUBSECTIMEDIGITIZED	37522	/* DateTimeDigitized subseconds */
+#define EXIFTAG_FLASHPIXVERSION		40960	/* Supported Flashpix version */
+#define EXIFTAG_COLORSPACE		40961	/* Color space information */
+#define EXIFTAG_PIXELXDIMENSION		40962	/* Valid image width */
+#define EXIFTAG_PIXELYDIMENSION		40963	/* Valid image height */
+#define EXIFTAG_RELATEDSOUNDFILE	40964	/* Related audio file */
+#define EXIFTAG_FLASHENERGY		41483	/* Flash energy */
+#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484	/* Spatial frequency response */
+#define EXIFTAG_FOCALPLANEXRESOLUTION	41486	/* Focal plane X resolution */
+#define EXIFTAG_FOCALPLANEYRESOLUTION	41487	/* Focal plane Y resolution */
+#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488	/* Focal plane resolution unit */
+#define EXIFTAG_SUBJECTLOCATION		41492	/* Subject location */
+#define EXIFTAG_EXPOSUREINDEX		41493	/* Exposure index */
+#define EXIFTAG_SENSINGMETHOD		41495	/* Sensing method */
+#define EXIFTAG_FILESOURCE		41728	/* File source */
+#define EXIFTAG_SCENETYPE		41729	/* Scene type */
+#define EXIFTAG_CFAPATTERN		41730	/* CFA pattern */
+#define EXIFTAG_CUSTOMRENDERED		41985	/* Custom image processing */
+#define EXIFTAG_EXPOSUREMODE		41986	/* Exposure mode */
+#define EXIFTAG_WHITEBALANCE		41987	/* White balance */
+#define EXIFTAG_DIGITALZOOMRATIO	41988	/* Digital zoom ratio */
+#define EXIFTAG_FOCALLENGTHIN35MMFILM	41989	/* Focal length in 35 mm film */
+#define EXIFTAG_SCENECAPTURETYPE	41990	/* Scene capture type */
+#define EXIFTAG_GAINCONTROL		41991	/* Gain control */
+#define EXIFTAG_CONTRAST		41992	/* Contrast */
+#define EXIFTAG_SATURATION		41993	/* Saturation */
+#define EXIFTAG_SHARPNESS		41994	/* Sharpness */
+#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995	/* Device settings description */
+#define EXIFTAG_SUBJECTDISTANCERANGE	41996	/* Subject distance range */
+#define EXIFTAG_GAINCONTROL		41991	/* Gain control */
+#define EXIFTAG_GAINCONTROL		41991	/* Gain control */
+#define EXIFTAG_IMAGEUNIQUEID		42016	/* Unique image ID */
+
+#endif /* _TIFF_ */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffcomp.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffcomp.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffcomp.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,220 @@
+/* $Header: /cvsroot/osrs/libtiff/libtiff/tiffcomp.h,v 1.4 2003/10/12 08:46:11 dron Exp $ */
+
+/*
+ * Copyright (c) 1990-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _COMPAT_
+#define	_COMPAT_
+/*
+ * This file contains a hodgepodge of definitions and
+ * declarations that are needed to provide compatibility
+ * between the native system and the base implementation
+ * that the library assumes.
+ *
+ * NB: This file is a mess.
+ */
+
+/*
+ * Setup basic type definitions and function declaratations.
+ */
+
+/*
+ * Simplify Acorn RISC OS identifier (to avoid confusion with Acorn RISC iX
+ * and with defunct Unix Risc OS)
+ * No need to specify __arm - hey, Acorn might port the OS, no problem here!
+ */
+#ifdef __acornriscos
+#undef __acornriscos
+#endif
+#if defined(__acorn) && defined(__riscos)
+#define __acornriscos
+#endif
+
+#if defined(__MWERKS__) || defined(THINK_C)
+#include <unix.h>
+#include <math.h>
+#endif
+
+#include <stdio.h>
+
+#if defined(__PPCC__) || defined(__SC__) || defined(__MRC__)
+#include <types.h>
+#elif !defined(__MWERKS__) && !defined(THINK_C) && !defined(__acornriscos) && !defined(applec)
+#include <sys/types.h>
+#endif
+
+#if defined(VMS)
+#include <file.h>
+#include <unixio.h>
+#elif !defined(__acornriscos)
+#include <fcntl.h>
+#endif
+
+/*
+ * This maze of checks controls defines or not the
+ * target system has BSD-style typdedefs declared in
+ * an include file and/or whether or not to include
+ * <unistd.h> to get the SEEK_* definitions.  Some
+ * additional includes are also done to pull in the
+ * appropriate definitions we're looking for.
+ */
+#if defined(__MWERKS__) || defined(THINK_C) || defined(__PPCC__) || defined(__SC__) || defined(__MRC__)
+#include <stdlib.h>
+#define	BSDTYPES
+#define	HAVE_UNISTD_H	0
+#elif (defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows) || defined(_WIN32)) && !defined(unix)
+#define	BSDTYPES
+#elif defined(OS2_16) || defined(OS2_32)
+#define	BSDTYPES
+#elif defined(__acornriscos)
+#include <stdlib.h>
+#define	BSDTYPES
+#define	HAVE_UNISTD_H	0
+#elif defined(VMS)
+#define	HAVE_UNISTD_H	0
+#else
+#define	HAVE_UNISTD_H	1
+#endif
+
+/*
+ * The library uses the ANSI C/POSIX SEEK_*
+ * definitions that should be defined in unistd.h
+ * (except on system where they are in stdio.h and
+ * there is no unistd.h).
+ */
+#if !defined(SEEK_SET) && HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+/*
+ * The library uses memset, memcpy, and memcmp.
+ * ANSI C and System V define these in string.h.
+ */
+#include <string.h>
+
+/*
+ * The BSD typedefs are used throughout the library.
+ * If your system doesn't have them in <sys/types.h>,
+ * then define BSDTYPES in your Makefile.
+ */
+#if defined(BSDTYPES)
+# ifndef _BSDTYPES_DEFINED
+#  ifndef __u_char_defined
+typedef	unsigned char u_char;
+typedef	unsigned short u_short;
+typedef	unsigned int u_int;
+typedef	unsigned long u_long;
+#   define __u_char_defined
+#  endif /* __u_char_defined */
+#  define _BSDTYPES_DEFINED
+# endif /* _BSDTYPES_DEFINED */
+#endif /* BSDTYPES */
+
+/*
+ * dblparam_t is the type that a double precision
+ * floating point value will have on the parameter
+ * stack (when coerced by the compiler).
+ */
+/* Note: on MacPowerPC "extended" is undefined. So only use it for 68K-Macs */
+#if defined(__SC__) || defined(THINK_C)
+typedef extended dblparam_t;
+#else
+typedef double dblparam_t;
+#endif
+
+/*
+ * If your compiler supports inline functions, then
+ * set INLINE appropriately to get the known hotspots
+ * in the library expanded inline.
+ */
+#if defined(__GNUC__)
+#if defined(__STRICT_ANSI__)
+#define	INLINE	__inline__
+#else
+#define	INLINE	inline
+#endif
+#else /* !__GNUC__ */
+#define	INLINE
+#endif
+
+/*
+ * GLOBALDATA is a macro that is used to define global variables
+ * private to the library.  We use this indirection to hide
+ * brain-damage in VAXC (and GCC) under VAX/VMS.  In these
+ * environments the macro places the variable in a non-shareable
+ * program section, which ought to be done by default (sigh!)
+ *
+ * Apparently DEC are aware of the problem as this behaviour is the
+ * default under VMS on AXP.
+ *
+ * The GNU C variant is untested.
+ */
+#if defined(VAX) && defined(VMS)
+#if defined(VAXC)
+#define GLOBALDATA(TYPE,NAME)	extern noshare TYPE NAME
+#endif
+#if defined(__GNUC__)
+#define GLOBALDATA(TYPE,NAME)	extern TYPE NAME \
+	asm("_$$PsectAttributes_NOSHR$$" #NAME)
+#endif
+#else	/* !VAX/VMS */
+#define GLOBALDATA(TYPE,NAME)	extern TYPE NAME
+#endif
+
+#if defined(__acornriscos)
+/*
+ * osfcn.h is part of C++Lib on Acorn C/C++, and as such can't be used
+ * on C alone. For that reason, the relevant functions are
+ * implemented in tif_acorn.c, and the elements from the header
+ * file are included here.
+ */
+#if defined(__cplusplus)
+#include <osfcn.h>
+#else
+#define	O_RDONLY	0
+#define	O_WRONLY	1
+#define	O_RDWR		2
+#define	O_APPEND	8
+#define	O_CREAT		0x200
+#define	O_TRUNC		0x400
+typedef long off_t;
+extern int open(const char *name, int flags, int mode);
+extern int close(int fd);
+extern int write(int fd, const char *buf, int nbytes);
+extern int read(int fd, char *buf, int nbytes);
+extern off_t lseek(int fd, off_t offset, int whence);
+extern int creat(const char *path, int mode);
+#endif /* __cplusplus */
+#endif /* __acornriscos */
+
+/* Bit and byte order, the default is MSB to LSB */
+#ifdef VMS
+#undef HOST_FILLORDER
+#undef HOST_BIGENDIAN
+#define HOST_FILLORDER FILLORDER_LSB2MSB
+#define HOST_BIGENDIAN	0
+#endif
+
+
+#endif /* _COMPAT_ */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffconf.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffconf.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffconf.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,101 @@
+/* libtiff/tiffconf.h.  Generated by configure.  */
+/*
+  Configuration defines for installed libtiff.
+  This file maintained for backward compatibility. Do not use definitions
+  from this file in your programs.
+*/
+
+#ifndef _TIFFCONF_
+#define _TIFFCONF_
+
+/* Define to 1 if the system has the type `int16'. */
+/* #undef HAVE_INT16 */
+
+/* Define to 1 if the system has the type `int32'. */
+/* #undef HAVE_INT32 */
+
+/* Define to 1 if the system has the type `int8'. */
+/* #undef HAVE_INT8 */
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* Compatibility stuff. */
+
+/* Define as 0 or 1 according to the floating point format suported by the
+   machine */
+#define HAVE_IEEEFP 1
+
+/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
+#define HOST_FILLORDER FILLORDER_LSB2MSB
+
+/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
+   (Intel) */
+#define HOST_BIGENDIAN 0
+
+/* Support CCITT Group 3 & 4 algorithms */
+#define CCITT_SUPPORT 1
+
+/* Support JPEG compression (requires IJG JPEG library) */
+#define JPEG_SUPPORT 1
+
+/* Support LogLuv high dynamic range encoding */
+#define LOGLUV_SUPPORT 1
+
+/* Support LZW algorithm */
+#define LZW_SUPPORT 1
+
+/* Support NeXT 2-bit RLE algorithm */
+#define NEXT_SUPPORT 1
+
+/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
+   fails with unpatched IJG JPEG library) */
+/* #undef OJPEG_SUPPORT */
+
+/* Support Macintosh PackBits algorithm */
+#define PACKBITS_SUPPORT 1
+
+/* Support Pixar log-format algorithm (requires Zlib) */
+#define PIXARLOG_SUPPORT 1
+
+/* Support ThunderScan 4-bit RLE algorithm */
+#define THUNDER_SUPPORT 1
+
+/* Support Deflate compression */
+#define ZIP_SUPPORT 1
+
+/* Support strip chopping (whether or not to convert single-strip uncompressed
+   images to mutiple strips of ~8Kb to reduce memory usage) */
+#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
+
+/* Enable SubIFD tag (330) support */
+#define SUBIFD_SUPPORT 1
+
+/* Treat extra sample as alpha (default enabled). The RGBA interface will
+   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
+   packages produce RGBA files but don't mark the alpha properly. */
+#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
+
+/* Pick up YCbCr subsampling info from the JPEG data stream to support files
+   lacking the tag (default enabled). */
+#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
+
+/* Support MS MDI magic number files as TIFF */
+#define MDI_SUPPORT 1
+
+/*
+ * Feature support definitions.
+ * XXX: These macros are obsoleted. Don't use them in your apps!
+ * Macros stays here for backward compatibility and should be always defined.
+ */
+#define COLORIMETRY_SUPPORT
+#define YCBCR_SUPPORT
+#define CMYK_SUPPORT
+#define ICC_SUPPORT
+#define PHOTOSHOP_SUPPORT
+#define IPTC_SUPPORT
+
+#endif /* _TIFFCONF_ */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffio.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffio.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffio.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,549 @@
+/* $Id: tiffio.h,v 1.50 2006/03/21 16:37:51 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _TIFFIO_
+#define	_TIFFIO_
+
+#ifndef __GNUC__
+# define __DLL_IMPORT__  __declspec(dllimport)
+# define __DLL_EXPORT__  __declspec(dllexport)
+#else
+# define __DLL_IMPORT__  __attribute__((dllimport)) extern
+# define __DLL_EXPORT__  __attribute__((dllexport)) extern
+#endif 
+
+#if (defined __WIN32__) || (defined _WIN32)
+# ifdef BUILD_LIBTIFF_DLL
+#  define LIBTIFF_DLL_IMPEXP     __DLL_EXPORT__
+# elif defined(LIBTIFF_STATIC)
+#  define LIBTIFF_DLL_IMPEXP      
+# elif defined (USE_LIBTIFF_DLL)
+#  define LIBTIFF_DLL_IMPEXP     __DLL_IMPORT__
+# elif defined (USE_LIBTIFF_STATIC)
+#  define LIBTIFF_DLL_IMPEXP      
+# else /* assume USE_LIBTIFF_DLL */
+#  define LIBTIFF_DLL_IMPEXP     __DLL_IMPORT__
+# endif
+#else /* __WIN32__ */
+# define LIBTIFF_DLL_IMPEXP  
+#endif
+
+/*
+ * TIFF I/O Library Definitions.
+ */
+#include "tiff.h"
+#include "tiffvers.h"
+
+/*
+ * TIFF is defined as an incomplete type to hide the
+ * library's internal data structures from clients.
+ */
+typedef	struct tiff TIFF;
+
+/*
+ * The following typedefs define the intrinsic size of
+ * data types used in the *exported* interfaces.  These
+ * definitions depend on the proper definition of types
+ * in tiff.h.  Note also that the varargs interface used
+ * to pass tag types and values uses the types defined in
+ * tiff.h directly.
+ *
+ * NB: ttag_t is unsigned int and not unsigned short because
+ *     ANSI C requires that the type before the ellipsis be a
+ *     promoted type (i.e. one of int, unsigned int, pointer,
+ *     or double) and because we defined pseudo-tags that are
+ *     outside the range of legal Aldus-assigned tags.
+ * NB: tsize_t is int32 and not uint32 because some functions
+ *     return -1.
+ * NB: toff_t is not off_t for many reasons; TIFFs max out at
+ *     32-bit file offsets being the most important, and to ensure
+ *     that it is unsigned, rather than signed.
+ */
+typedef	uint32 ttag_t;		/* directory tag */
+typedef	uint16 tdir_t;		/* directory index */
+typedef	uint16 tsample_t;	/* sample number */
+typedef	uint32 tstrip_t;	/* strip number */
+typedef uint32 ttile_t;		/* tile number */
+typedef	int32 tsize_t;		/* i/o size in bytes */
+typedef	void* tdata_t;		/* image data ref */
+typedef	uint32 toff_t;		/* file offset */
+
+#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
+#define __WIN32__
+#endif
+
+/*
+ * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
+ * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
+ *
+ * By default tif_unix.c is assumed.
+ */
+
+#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
+#  define BINMODE "b"
+#  if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
+#    define AVOID_WIN32_FILEIO
+#  endif
+#  include <fcntl.h>
+#  include <io.h>
+#  ifdef SET_BINARY
+#    undef SET_BINARY
+#  endif /* SET_BINARY */
+#  define SET_BINARY(f) do {if (!_isatty(f)) _setmode(f,_O_BINARY);} while (0)
+#else /* Windows */
+#  define BINMODE
+#  define SET_BINARY(f) (void)0
+#endif /* Windows */
+
+#if defined(USE_WIN32_FILEIO)
+# define VC_EXTRALEAN
+# include <windows.h>
+# ifdef __WIN32__
+DECLARE_HANDLE(thandle_t);	/* Win32 file handle */
+# else
+typedef	HFILE thandle_t;	/* client data handle */
+# endif /* __WIN32__ */
+#else
+typedef	void* thandle_t;	/* client data handle */
+#endif /* USE_WIN32_FILEIO */
+
+#ifndef NULL
+# define NULL	(void *)0
+#endif
+
+/*
+ * Flags to pass to TIFFPrintDirectory to control
+ * printing of data structures that are potentially
+ * very large.   Bit-or these flags to enable printing
+ * multiple items.
+ */
+#define	TIFFPRINT_NONE		0x0		/* no extra info */
+#define	TIFFPRINT_STRIPS	0x1		/* strips/tiles info */
+#define	TIFFPRINT_CURVES	0x2		/* color/gray response curves */
+#define	TIFFPRINT_COLORMAP	0x4		/* colormap */
+#define	TIFFPRINT_JPEGQTABLES	0x100		/* JPEG Q matrices */
+#define	TIFFPRINT_JPEGACTABLES	0x200		/* JPEG AC tables */
+#define	TIFFPRINT_JPEGDCTABLES	0x200		/* JPEG DC tables */
+
+/* 
+ * Colour conversion stuff
+ */
+
+/* reference white */
+#define D65_X0 (95.0470F)
+#define D65_Y0 (100.0F)
+#define D65_Z0 (108.8827F)
+
+#define D50_X0 (96.4250F)
+#define D50_Y0 (100.0F)
+#define D50_Z0 (82.4680F)
+
+/* Structure for holding information about a display device. */
+
+typedef	unsigned char TIFFRGBValue;		/* 8-bit samples */
+
+typedef struct {
+	float d_mat[3][3]; 		/* XYZ -> luminance matrix */
+	float d_YCR;			/* Light o/p for reference white */
+	float d_YCG;
+	float d_YCB;
+	uint32 d_Vrwr;			/* Pixel values for ref. white */
+	uint32 d_Vrwg;
+	uint32 d_Vrwb;
+	float d_Y0R;			/* Residual light for black pixel */
+	float d_Y0G;
+	float d_Y0B;
+	float d_gammaR;			/* Gamma values for the three guns */
+	float d_gammaG;
+	float d_gammaB;
+} TIFFDisplay;
+
+typedef struct {				/* YCbCr->RGB support */
+	TIFFRGBValue* clamptab;			/* range clamping table */
+	int*	Cr_r_tab;
+	int*	Cb_b_tab;
+	int32*	Cr_g_tab;
+	int32*	Cb_g_tab;
+        int32*  Y_tab;
+} TIFFYCbCrToRGB;
+
+typedef struct {				/* CIE Lab 1976->RGB support */
+	int	range;				/* Size of conversion table */
+#define CIELABTORGB_TABLE_RANGE 1500
+	float	rstep, gstep, bstep;
+	float	X0, Y0, Z0;			/* Reference white point */
+	TIFFDisplay display;
+	float	Yr2r[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yr to r */
+	float	Yg2g[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yg to g */
+	float	Yb2b[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yb to b */
+} TIFFCIELabToRGB;
+
+/*
+ * RGBA-style image support.
+ */
+typedef struct _TIFFRGBAImage TIFFRGBAImage;
+/*
+ * The image reading and conversion routines invoke
+ * ``put routines'' to copy/image/whatever tiles of
+ * raw image data.  A default set of routines are 
+ * provided to convert/copy raw image data to 8-bit
+ * packed ABGR format rasters.  Applications can supply
+ * alternate routines that unpack the data into a
+ * different format or, for example, unpack the data
+ * and draw the unpacked raster on the display.
+ */
+typedef void (*tileContigRoutine)
+    (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
+	unsigned char*);
+typedef void (*tileSeparateRoutine)
+    (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
+	unsigned char*, unsigned char*, unsigned char*, unsigned char*);
+/*
+ * RGBA-reader state.
+ */
+struct _TIFFRGBAImage {
+	TIFF*	tif;				/* image handle */
+	int	stoponerr;			/* stop on read error */
+	int	isContig;			/* data is packed/separate */
+	int	alpha;				/* type of alpha data present */
+	uint32	width;				/* image width */
+	uint32	height;				/* image height */
+	uint16	bitspersample;			/* image bits/sample */
+	uint16	samplesperpixel;		/* image samples/pixel */
+	uint16	orientation;			/* image orientation */
+	uint16	req_orientation;		/* requested orientation */
+	uint16	photometric;			/* image photometric interp */
+	uint16*	redcmap;			/* colormap pallete */
+	uint16*	greencmap;
+	uint16*	bluecmap;
+						/* get image data routine */
+	int	(*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
+	union {
+	    void (*any)(TIFFRGBAImage*);
+	    tileContigRoutine	contig;
+	    tileSeparateRoutine	separate;
+	} put;					/* put decoded strip/tile */
+	TIFFRGBValue* Map;			/* sample mapping array */
+	uint32** BWmap;				/* black&white map */
+	uint32** PALmap;			/* palette image map */
+	TIFFYCbCrToRGB* ycbcr;			/* YCbCr conversion state */
+        TIFFCIELabToRGB* cielab;		/* CIE L*a*b conversion state */
+
+        int	row_offset;
+        int     col_offset;
+};
+
+/*
+ * Macros for extracting components from the
+ * packed ABGR form returned by TIFFReadRGBAImage.
+ */
+#define	TIFFGetR(abgr)	((abgr) & 0xff)
+#define	TIFFGetG(abgr)	(((abgr) >> 8) & 0xff)
+#define	TIFFGetB(abgr)	(((abgr) >> 16) & 0xff)
+#define	TIFFGetA(abgr)	(((abgr) >> 24) & 0xff)
+
+/*
+ * A CODEC is a software package that implements decoding,
+ * encoding, or decoding+encoding of a compression algorithm.
+ * The library provides a collection of builtin codecs.
+ * More codecs may be registered through calls to the library
+ * and/or the builtin implementations may be overridden.
+ */
+typedef	int (*TIFFInitMethod)(TIFF*, int);
+typedef struct {
+	char*		name;
+	uint16		scheme;
+	TIFFInitMethod	init;
+} TIFFCodec;
+
+#include <stdio.h>
+#include <stdarg.h>
+
+/* share internal LogLuv conversion routines? */
+#ifndef LOGLUV_PUBLIC
+#define LOGLUV_PUBLIC		1
+#endif
+
+#if defined(c_plusplus) || defined(__cplusplus)
+extern "C" {
+#endif
+typedef	void (*TIFFErrorHandler)(const char*, const char*, va_list);
+typedef	void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
+typedef	tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
+typedef	toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
+typedef	int (*TIFFCloseProc)(thandle_t);
+typedef	toff_t (*TIFFSizeProc)(thandle_t);
+typedef	int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);
+typedef	void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);
+typedef	void (*TIFFExtendProc)(TIFF*); 
+
+LIBTIFF_DLL_IMPEXP	const char* TIFFGetVersion(void);
+
+LIBTIFF_DLL_IMPEXP	const TIFFCodec* TIFFFindCODEC(uint16);
+LIBTIFF_DLL_IMPEXP	TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
+LIBTIFF_DLL_IMPEXP	void TIFFUnRegisterCODEC(TIFFCodec*);
+LIBTIFF_DLL_IMPEXP  int TIFFIsCODECConfigured(uint16);
+LIBTIFF_DLL_IMPEXP	TIFFCodec* TIFFGetConfiguredCODECs(void);
+
+/*
+ * Auxiliary functions.
+ */
+
+LIBTIFF_DLL_IMPEXP	tdata_t _TIFFmalloc(tsize_t);
+LIBTIFF_DLL_IMPEXP	tdata_t _TIFFrealloc(tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	void _TIFFmemset(tdata_t, int, tsize_t);
+LIBTIFF_DLL_IMPEXP	void _TIFFmemcpy(tdata_t, const tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	int _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	void _TIFFfree(tdata_t);
+
+/*
+** Stuff, related to tag handling and creating custom tags.
+*/
+LIBTIFF_DLL_IMPEXP  int  TIFFGetTagListCount( TIFF * );
+LIBTIFF_DLL_IMPEXP  ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );
+    
+#define	TIFF_ANY	TIFF_NOTYPE	/* for field descriptor searching */
+#define	TIFF_VARIABLE	-1		/* marker for variable length tags */
+#define	TIFF_SPP	-2		/* marker for SamplesPerPixel tags */
+#define	TIFF_VARIABLE2	-3		/* marker for uint32 var-length tags */
+
+#define FIELD_CUSTOM    65    
+
+typedef	struct {
+	ttag_t	field_tag;		/* field's tag */
+	short	field_readcount;	/* read count/TIFF_VARIABLE/TIFF_SPP */
+	short	field_writecount;	/* write count/TIFF_VARIABLE */
+	TIFFDataType field_type;	/* type of associated data */
+        unsigned short field_bit;	/* bit in fieldsset bit vector */
+	unsigned char field_oktochange;	/* if true, can change while writing */
+	unsigned char field_passcount;	/* if true, pass dir count on set */
+	char	*field_name;		/* ASCII name */
+} TIFFFieldInfo;
+
+typedef struct _TIFFTagValue {
+    const TIFFFieldInfo  *info;
+    int             count;
+    void           *value;
+} TIFFTagValue;
+
+LIBTIFF_DLL_IMPEXP	void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
+LIBTIFF_DLL_IMPEXP	const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
+LIBTIFF_DLL_IMPEXP  const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,
+						     TIFFDataType);
+LIBTIFF_DLL_IMPEXP	const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);
+LIBTIFF_DLL_IMPEXP	const TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);
+
+typedef	int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
+typedef	int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
+typedef	void (*TIFFPrintMethod)(TIFF*, FILE*, long);
+    
+typedef struct {
+    TIFFVSetMethod	vsetfield;	/* tag set routine */
+    TIFFVGetMethod	vgetfield;	/* tag get routine */
+    TIFFPrintMethod	printdir;	/* directory print routine */
+} TIFFTagMethods;
+        
+LIBTIFF_DLL_IMPEXP  TIFFTagMethods *TIFFAccessTagMethods( TIFF * );
+LIBTIFF_DLL_IMPEXP  void *TIFFGetClientInfo( TIFF *, const char * );
+LIBTIFF_DLL_IMPEXP  void TIFFSetClientInfo( TIFF *, void *, const char * );
+
+LIBTIFF_DLL_IMPEXP	void TIFFCleanup(TIFF*);
+LIBTIFF_DLL_IMPEXP	void TIFFClose(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFFlush(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFFlushData(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFGetField(TIFF*, ttag_t, ...);
+LIBTIFF_DLL_IMPEXP	int TIFFVGetField(TIFF*, ttag_t, va_list);
+LIBTIFF_DLL_IMPEXP	int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);
+LIBTIFF_DLL_IMPEXP	int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);
+LIBTIFF_DLL_IMPEXP	int TIFFReadDirectory(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFReadCustomDirectory(TIFF*, toff_t, const TIFFFieldInfo[],
+				    size_t);
+LIBTIFF_DLL_IMPEXP	int TIFFReadEXIFDirectory(TIFF*, toff_t);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFScanlineSize(TIFF*);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFRasterScanlineSize(TIFF*);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFStripSize(TIFF*);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFRawStripSize(TIFF*, tstrip_t);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFVStripSize(TIFF*, uint32);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFTileRowSize(TIFF*);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFTileSize(TIFF*);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFVTileSize(TIFF*, uint32);
+LIBTIFF_DLL_IMPEXP	uint32 TIFFDefaultStripSize(TIFF*, uint32);
+LIBTIFF_DLL_IMPEXP	void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
+LIBTIFF_DLL_IMPEXP	int TIFFFileno(TIFF*);
+LIBTIFF_DLL_IMPEXP  int TIFFSetFileno(TIFF*, int);
+LIBTIFF_DLL_IMPEXP  thandle_t TIFFClientdata(TIFF*);
+LIBTIFF_DLL_IMPEXP  thandle_t TIFFSetClientdata(TIFF*, thandle_t);
+LIBTIFF_DLL_IMPEXP	int TIFFGetMode(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFSetMode(TIFF*, int);
+LIBTIFF_DLL_IMPEXP	int TIFFIsTiled(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFIsByteSwapped(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFIsUpSampled(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFIsMSB2LSB(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFIsBigEndian(TIFF*);
+LIBTIFF_DLL_IMPEXP	TIFFReadWriteProc TIFFGetReadProc(TIFF*);
+LIBTIFF_DLL_IMPEXP	TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
+LIBTIFF_DLL_IMPEXP	TIFFSeekProc TIFFGetSeekProc(TIFF*);
+LIBTIFF_DLL_IMPEXP	TIFFCloseProc TIFFGetCloseProc(TIFF*);
+LIBTIFF_DLL_IMPEXP	TIFFSizeProc TIFFGetSizeProc(TIFF*);
+LIBTIFF_DLL_IMPEXP	TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
+LIBTIFF_DLL_IMPEXP	TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
+LIBTIFF_DLL_IMPEXP	uint32 TIFFCurrentRow(TIFF*);
+LIBTIFF_DLL_IMPEXP	tdir_t TIFFCurrentDirectory(TIFF*);
+LIBTIFF_DLL_IMPEXP	tdir_t TIFFNumberOfDirectories(TIFF*);
+LIBTIFF_DLL_IMPEXP	uint32 TIFFCurrentDirOffset(TIFF*);
+LIBTIFF_DLL_IMPEXP	tstrip_t TIFFCurrentStrip(TIFF*);
+LIBTIFF_DLL_IMPEXP	ttile_t TIFFCurrentTile(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	int TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	int TIFFSetupStrips(TIFF *);
+LIBTIFF_DLL_IMPEXP  int TIFFWriteCheck(TIFF*, int, const char *);
+LIBTIFF_DLL_IMPEXP	void TIFFFreeDirectory(TIFF*);
+LIBTIFF_DLL_IMPEXP  int TIFFCreateDirectory(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFLastDirectory(TIFF*);
+LIBTIFF_DLL_IMPEXP	int TIFFSetDirectory(TIFF*, tdir_t);
+LIBTIFF_DLL_IMPEXP	int TIFFSetSubDirectory(TIFF*, uint32);
+LIBTIFF_DLL_IMPEXP	int TIFFUnlinkDirectory(TIFF*, tdir_t);
+LIBTIFF_DLL_IMPEXP	int TIFFSetField(TIFF*, ttag_t, ...);
+LIBTIFF_DLL_IMPEXP	int TIFFVSetField(TIFF*, ttag_t, va_list);
+LIBTIFF_DLL_IMPEXP	int TIFFWriteDirectory(TIFF *);
+LIBTIFF_DLL_IMPEXP	int TIFFCheckpointDirectory(TIFF *);
+LIBTIFF_DLL_IMPEXP	int TIFFRewriteDirectory(TIFF *);
+LIBTIFF_DLL_IMPEXP	int TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);
+
+#if defined(c_plusplus) || defined(__cplusplus)
+LIBTIFF_DLL_IMPEXP	void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
+LIBTIFF_DLL_IMPEXP	int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
+LIBTIFF_DLL_IMPEXP	int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
+LIBTIFF_DLL_IMPEXP	int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
+LIBTIFF_DLL_IMPEXP	int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
+				      int = ORIENTATION_BOTLEFT, int = 0);
+#else
+LIBTIFF_DLL_IMPEXP	void TIFFPrintDirectory(TIFF*, FILE*, long);
+LIBTIFF_DLL_IMPEXP	int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
+LIBTIFF_DLL_IMPEXP	int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
+LIBTIFF_DLL_IMPEXP	int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
+LIBTIFF_DLL_IMPEXP	int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
+#endif
+
+LIBTIFF_DLL_IMPEXP	int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );
+LIBTIFF_DLL_IMPEXP	int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
+LIBTIFF_DLL_IMPEXP	int TIFFRGBAImageOK(TIFF*, char [1024]);
+LIBTIFF_DLL_IMPEXP	int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
+LIBTIFF_DLL_IMPEXP	int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
+LIBTIFF_DLL_IMPEXP	void TIFFRGBAImageEnd(TIFFRGBAImage*);
+LIBTIFF_DLL_IMPEXP	TIFF* TIFFOpen(const char*, const char*);
+# ifdef __WIN32__
+LIBTIFF_DLL_IMPEXP	TIFF* TIFFOpenW(const wchar_t*, const char*);
+# endif /* __WIN32__ */
+LIBTIFF_DLL_IMPEXP	TIFF* TIFFFdOpen(int, const char*, const char*);
+LIBTIFF_DLL_IMPEXP	TIFF* TIFFClientOpen(const char*, const char*,
+	    thandle_t,
+	    TIFFReadWriteProc, TIFFReadWriteProc,
+	    TIFFSeekProc, TIFFCloseProc,
+	    TIFFSizeProc,
+	    TIFFMapFileProc, TIFFUnmapFileProc);
+LIBTIFF_DLL_IMPEXP	const char* TIFFFileName(TIFF*);
+LIBTIFF_DLL_IMPEXP	const char* TIFFSetFileName(TIFF*, const char *);
+LIBTIFF_DLL_IMPEXP	void TIFFError(const char*, const char*, ...);
+LIBTIFF_DLL_IMPEXP	void TIFFErrorExt(thandle_t, const char*, const char*, ...);
+LIBTIFF_DLL_IMPEXP	void TIFFWarning(const char*, const char*, ...);
+LIBTIFF_DLL_IMPEXP	void TIFFWarningExt(thandle_t, const char*, const char*, ...);
+LIBTIFF_DLL_IMPEXP	TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
+LIBTIFF_DLL_IMPEXP	TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
+LIBTIFF_DLL_IMPEXP	TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
+LIBTIFF_DLL_IMPEXP	TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
+LIBTIFF_DLL_IMPEXP	TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
+LIBTIFF_DLL_IMPEXP	ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);
+LIBTIFF_DLL_IMPEXP	int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);
+LIBTIFF_DLL_IMPEXP	ttile_t TIFFNumberOfTiles(TIFF*);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFReadTile(TIFF*,
+	    tdata_t, uint32, uint32, uint32, tsample_t);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFWriteTile(TIFF*,
+	    tdata_t, uint32, uint32, uint32, tsample_t);
+LIBTIFF_DLL_IMPEXP	tstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t);
+LIBTIFF_DLL_IMPEXP	tstrip_t TIFFNumberOfStrips(TIFF*);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
+LIBTIFF_DLL_IMPEXP	int TIFFDataWidth(TIFFDataType);    /* table of tag datatype widths */
+LIBTIFF_DLL_IMPEXP	void TIFFSetWriteOffset(TIFF*, toff_t);
+LIBTIFF_DLL_IMPEXP	void TIFFSwabShort(uint16*);
+LIBTIFF_DLL_IMPEXP	void TIFFSwabLong(uint32*);
+LIBTIFF_DLL_IMPEXP	void TIFFSwabDouble(double*);
+LIBTIFF_DLL_IMPEXP	void TIFFSwabArrayOfShort(uint16*, unsigned long);
+LIBTIFF_DLL_IMPEXP	void TIFFSwabArrayOfTriples(uint8*, unsigned long);
+LIBTIFF_DLL_IMPEXP	void TIFFSwabArrayOfLong(uint32*, unsigned long);
+LIBTIFF_DLL_IMPEXP	void TIFFSwabArrayOfDouble(double*, unsigned long);
+LIBTIFF_DLL_IMPEXP	void TIFFReverseBits(unsigned char *, unsigned long);
+LIBTIFF_DLL_IMPEXP	const unsigned char* TIFFGetBitRevTable(int);
+
+#ifdef LOGLUV_PUBLIC
+#define U_NEU		0.210526316
+#define V_NEU		0.473684211
+#define UVSCALE		410.
+LIBTIFF_DLL_IMPEXP	double LogL16toY(int);
+LIBTIFF_DLL_IMPEXP	double LogL10toY(int);
+LIBTIFF_DLL_IMPEXP	void XYZtoRGB24(float*, uint8*);
+LIBTIFF_DLL_IMPEXP	int uv_decode(double*, double*, int);
+LIBTIFF_DLL_IMPEXP	void LogLuv24toXYZ(uint32, float*);
+LIBTIFF_DLL_IMPEXP	void LogLuv32toXYZ(uint32, float*);
+#if defined(c_plusplus) || defined(__cplusplus)
+LIBTIFF_DLL_IMPEXP	int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
+LIBTIFF_DLL_IMPEXP	int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
+LIBTIFF_DLL_IMPEXP	int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
+LIBTIFF_DLL_IMPEXP	uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
+LIBTIFF_DLL_IMPEXP	uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
+#else
+LIBTIFF_DLL_IMPEXP	int LogL16fromY(double, int);
+LIBTIFF_DLL_IMPEXP	int LogL10fromY(double, int);
+LIBTIFF_DLL_IMPEXP	int uv_encode(double, double, int);
+LIBTIFF_DLL_IMPEXP	uint32 LogLuv24fromXYZ(float*, int);
+LIBTIFF_DLL_IMPEXP	uint32 LogLuv32fromXYZ(float*, int);
+#endif
+#endif /* LOGLUV_PUBLIC */
+    
+LIBTIFF_DLL_IMPEXP int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
+LIBTIFF_DLL_IMPEXP void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
+			    float *, float *, float *);
+LIBTIFF_DLL_IMPEXP void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
+			 uint32 *, uint32 *, uint32 *);
+
+LIBTIFF_DLL_IMPEXP int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
+LIBTIFF_DLL_IMPEXP void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
+			   uint32 *, uint32 *, uint32 *);
+
+#if defined(c_plusplus) || defined(__cplusplus)
+}
+#endif
+
+#endif /* _TIFFIO_ */
+
+/* vim: set ts=8 sts=8 sw=8 noet: */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffiop.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffiop.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffiop.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,288 @@
+/* $Header: /cvsroot/osrs/libtiff/libtiff/tiffiop.h,v 1.9 2003/12/24 22:07:23 dron Exp $ */
+
+/*
+ * Copyright (c) 1988-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _TIFFIOP_
+#define	_TIFFIOP_
+/*
+ * ``Library-private'' definitions.
+ */
+/*
+ * UNIX systems should run the configure script to generate
+ * a port.h file that reflects the system capabilities.
+ * Doing this obviates all the dreck done in tiffcomp.h.
+ */
+#if defined(unix) || defined(__unix)
+#include "port.h"
+#include "tiffconf.h"
+#else
+#include "tiffconf.h"
+#include "tiffcomp.h"
+#endif
+#include "tiffio.h"
+#include "tif_dir.h"
+
+#ifndef TRUE
+#define	TRUE	1
+#define	FALSE	0
+#endif
+
+typedef struct client_info {
+    struct client_info *next;
+    void      *data;
+    char      *name;
+} TIFFClientInfoLink;
+
+/*
+ * Typedefs for ``method pointers'' used internally.
+ */
+typedef	unsigned char tidataval_t;	/* internal image data value type */
+typedef	tidataval_t* tidata_t;		/* reference to internal image data */
+
+typedef	void (*TIFFVoidMethod)(TIFF*);
+typedef	int (*TIFFBoolMethod)(TIFF*);
+typedef	int (*TIFFPreMethod)(TIFF*, tsample_t);
+typedef	int (*TIFFCodeMethod)(TIFF*, tidata_t, tsize_t, tsample_t);
+typedef	int (*TIFFSeekMethod)(TIFF*, uint32);
+typedef	void (*TIFFPostMethod)(TIFF*, tidata_t, tsize_t);
+typedef	uint32 (*TIFFStripMethod)(TIFF*, uint32);
+typedef	void (*TIFFTileMethod)(TIFF*, uint32*, uint32*);
+
+struct tiff {
+	char*		tif_name;	/* name of open file */
+	int		tif_fd;		/* open file descriptor */
+	int		tif_mode;	/* open mode (O_*) */
+	uint32		tif_flags;
+#define	TIFF_FILLORDER		0x0003	/* natural bit fill order for machine */
+#define	TIFF_DIRTYHEADER	0x0004	/* header must be written on close */
+#define	TIFF_DIRTYDIRECT	0x0008	/* current directory must be written */
+#define	TIFF_BUFFERSETUP	0x0010	/* data buffers setup */
+#define	TIFF_CODERSETUP		0x0020	/* encoder/decoder setup done */
+#define	TIFF_BEENWRITING	0x0040	/* written 1+ scanlines to file */
+#define	TIFF_SWAB		0x0080	/* byte swap file information */
+#define	TIFF_NOBITREV		0x0100	/* inhibit bit reversal logic */
+#define	TIFF_MYBUFFER		0x0200	/* my raw data buffer; free on close */
+#define	TIFF_ISTILED		0x0400	/* file is tile, not strip- based */
+#define	TIFF_MAPPED		0x0800	/* file is mapped into memory */
+#define	TIFF_POSTENCODE		0x1000	/* need call to postencode routine */
+#define	TIFF_INSUBIFD		0x2000	/* currently writing a subifd */
+#define	TIFF_UPSAMPLED		0x4000	/* library is doing data up-sampling */ 
+#define	TIFF_STRIPCHOP		0x8000	/* enable strip chopping support */
+	toff_t		tif_diroff;	/* file offset of current directory */
+	toff_t		tif_nextdiroff;	/* file offset of following directory */
+	toff_t*		tif_dirlist;	/* list of offsets to already seen */
+					/* directories to prevent IFD looping */
+	uint16		tif_dirnumber;  /* number of already seen directories */
+	TIFFDirectory	tif_dir;	/* internal rep of current directory */
+	TIFFHeader	tif_header;	/* file's header block */
+	const int*	tif_typeshift;	/* data type shift counts */
+	const long*	tif_typemask;	/* data type masks */
+	uint32		tif_row;	/* current scanline */
+	tdir_t		tif_curdir;	/* current directory (index) */
+	tstrip_t	tif_curstrip;	/* current strip for read/write */
+	toff_t		tif_curoff;	/* current offset for read/write */
+	toff_t		tif_dataoff;	/* current offset for writing dir */
+#if SUBIFD_SUPPORT
+	uint16		tif_nsubifd;	/* remaining subifds to write */
+	toff_t		tif_subifdoff;	/* offset for patching SubIFD link */
+#endif
+/* tiling support */
+	uint32 		tif_col;	/* current column (offset by row too) */
+	ttile_t		tif_curtile;	/* current tile for read/write */
+	tsize_t		tif_tilesize;	/* # of bytes in a tile */
+/* compression scheme hooks */
+	int		tif_decodestatus;
+	TIFFBoolMethod	tif_setupdecode;/* called once before predecode */
+	TIFFPreMethod	tif_predecode;	/* pre- row/strip/tile decoding */
+	TIFFBoolMethod	tif_setupencode;/* called once before preencode */
+	int		tif_encodestatus;
+	TIFFPreMethod	tif_preencode;	/* pre- row/strip/tile encoding */
+	TIFFBoolMethod	tif_postencode;	/* post- row/strip/tile encoding */
+	TIFFCodeMethod	tif_decoderow;	/* scanline decoding routine */
+	TIFFCodeMethod	tif_encoderow;	/* scanline encoding routine */
+	TIFFCodeMethod	tif_decodestrip;/* strip decoding routine */
+	TIFFCodeMethod	tif_encodestrip;/* strip encoding routine */
+	TIFFCodeMethod	tif_decodetile;	/* tile decoding routine */
+	TIFFCodeMethod	tif_encodetile;	/* tile encoding routine */
+	TIFFVoidMethod	tif_close;	/* cleanup-on-close routine */
+	TIFFSeekMethod	tif_seek;	/* position within a strip routine */
+	TIFFVoidMethod	tif_cleanup;	/* cleanup state routine */
+	TIFFStripMethod	tif_defstripsize;/* calculate/constrain strip size */
+	TIFFTileMethod	tif_deftilesize;/* calculate/constrain tile size */
+	tidata_t	tif_data;	/* compression scheme private data */
+/* input/output buffering */
+	tsize_t		tif_scanlinesize;/* # of bytes in a scanline */
+	tsize_t		tif_scanlineskew;/* scanline skew for reading strips */
+	tidata_t	tif_rawdata;	/* raw data buffer */
+	tsize_t		tif_rawdatasize;/* # of bytes in raw data buffer */
+	tidata_t	tif_rawcp;	/* current spot in raw buffer */
+	tsize_t		tif_rawcc;	/* bytes unread from raw buffer */
+/* memory-mapped file support */
+	tidata_t	tif_base;	/* base of mapped file */
+	toff_t		tif_size;	/* size of mapped file region (bytes) */
+	TIFFMapFileProc	tif_mapproc;	/* map file method */
+	TIFFUnmapFileProc tif_unmapproc;/* unmap file method */
+/* input/output callback methods */
+	thandle_t	tif_clientdata;	/* callback parameter */
+	TIFFReadWriteProc tif_readproc;	/* read method */
+	TIFFReadWriteProc tif_writeproc;/* write method */
+	TIFFSeekProc	tif_seekproc;	/* lseek method */
+	TIFFCloseProc	tif_closeproc;	/* close method */
+	TIFFSizeProc	tif_sizeproc;	/* filesize method */
+/* post-decoding support */
+	TIFFPostMethod	tif_postdecode;	/* post decoding routine */
+/* tag support */
+	TIFFFieldInfo**	tif_fieldinfo;	/* sorted table of registered tags */
+	int		tif_nfields;	/* # entries in registered tag table */
+        TIFFTagMethods  tif_tagmethods; /* tag get/set/print routines */
+        TIFFClientInfoLink *tif_clientinfo; /* extra client information. */
+};
+
+#define	isPseudoTag(t)	(t > 0xffff)	/* is tag value normal or pseudo */
+
+#define	isTiled(tif)	(((tif)->tif_flags & TIFF_ISTILED) != 0)
+#define	isMapped(tif)	(((tif)->tif_flags & TIFF_MAPPED) != 0)
+#define	isFillOrder(tif, o)	(((tif)->tif_flags & (o)) != 0)
+#define	isUpSampled(tif)	(((tif)->tif_flags & TIFF_UPSAMPLED) != 0)
+#define	TIFFReadFile(tif, buf, size) \
+	((*(tif)->tif_readproc)((tif)->tif_clientdata,buf,size))
+#define	TIFFWriteFile(tif, buf, size) \
+	((*(tif)->tif_writeproc)((tif)->tif_clientdata,buf,size))
+#define	TIFFSeekFile(tif, off, whence) \
+	((*(tif)->tif_seekproc)((tif)->tif_clientdata,(toff_t)(off),whence))
+#define	TIFFCloseFile(tif) \
+	((*(tif)->tif_closeproc)((tif)->tif_clientdata))
+#define	TIFFGetFileSize(tif) \
+	((*(tif)->tif_sizeproc)((tif)->tif_clientdata))
+#define	TIFFMapFileContents(tif, paddr, psize) \
+	((*(tif)->tif_mapproc)((tif)->tif_clientdata,paddr,psize))
+#define	TIFFUnmapFileContents(tif, addr, size) \
+	((*(tif)->tif_unmapproc)((tif)->tif_clientdata,addr,size))
+
+/*
+ * Default Read/Seek/Write definitions.
+ */
+#ifndef ReadOK
+#define	ReadOK(tif, buf, size) \
+	(TIFFReadFile(tif, (tdata_t) buf, (tsize_t)(size)) == (tsize_t)(size))
+#endif
+#ifndef SeekOK
+#define	SeekOK(tif, off) \
+	(TIFFSeekFile(tif, (toff_t) off, SEEK_SET) == (toff_t) off)
+#endif
+#ifndef WriteOK
+#define	WriteOK(tif, buf, size) \
+	(TIFFWriteFile(tif, (tdata_t) buf, (tsize_t) size) == (tsize_t) size)
+#endif
+
+/* NB: the uint32 casts are to silence certain ANSI-C compilers */
+#define	TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))
+#define	TIFFroundup(x, y) (TIFFhowmany(x,y)*((uint32)(y)))
+
+#define TIFFmax(A,B) ((A)>(B)?(A):(B))
+#define TIFFmin(A,B) ((A)<(B)?(A):(B))
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+extern	int _TIFFgetMode(const char*, const char*);
+extern	int _TIFFNoRowEncode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	int _TIFFNoStripEncode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	int _TIFFNoTileEncode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	int _TIFFNoRowDecode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	int _TIFFNoStripDecode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	int _TIFFNoTileDecode(TIFF*, tidata_t, tsize_t, tsample_t);
+extern	void _TIFFNoPostDecode(TIFF*, tidata_t, tsize_t);
+extern  int  _TIFFNoPreCode (TIFF*, tsample_t); 
+extern	int _TIFFNoSeek(TIFF*, uint32);
+extern	void _TIFFSwab16BitData(TIFF*, tidata_t, tsize_t);
+extern	void _TIFFSwab32BitData(TIFF*, tidata_t, tsize_t);
+extern	void _TIFFSwab64BitData(TIFF*, tidata_t, tsize_t);
+extern	int TIFFFlushData1(TIFF*);
+extern	void TIFFFreeDirectory(TIFF*);
+extern	int TIFFDefaultDirectory(TIFF*);
+extern	int TIFFSetCompressionScheme(TIFF*, int);
+extern	int TIFFSetDefaultCompressionState(TIFF*);
+extern	uint32 _TIFFDefaultStripSize(TIFF*, uint32);
+extern	void _TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
+
+extern	void _TIFFsetByteArray(void**, void*, long);
+extern	void _TIFFsetString(char**, char*);
+extern	void _TIFFsetShortArray(uint16**, uint16*, long);
+extern	void _TIFFsetLongArray(uint32**, uint32*, long);
+extern	void _TIFFsetFloatArray(float**, float*, long);
+extern	void _TIFFsetDoubleArray(double**, double*, long);
+
+extern	void _TIFFprintAscii(FILE*, const char*);
+extern	void _TIFFprintAsciiTag(FILE*, const char*, const char*);
+
+GLOBALDATA(TIFFErrorHandler,_TIFFwarningHandler);
+GLOBALDATA(TIFFErrorHandler,_TIFFerrorHandler);
+
+extern	int TIFFInitDumpMode(TIFF*, int);
+#ifdef PACKBITS_SUPPORT
+extern	int TIFFInitPackBits(TIFF*, int);
+#endif
+#ifdef CCITT_SUPPORT
+extern	int TIFFInitCCITTRLE(TIFF*, int), TIFFInitCCITTRLEW(TIFF*, int);
+extern	int TIFFInitCCITTFax3(TIFF*, int), TIFFInitCCITTFax4(TIFF*, int);
+#endif
+#ifdef THUNDER_SUPPORT
+extern	int TIFFInitThunderScan(TIFF*, int);
+#endif
+#ifdef NEXT_SUPPORT
+extern	int TIFFInitNeXT(TIFF*, int);
+#endif
+#ifdef LZW_SUPPORT
+extern	int TIFFInitLZW(TIFF*, int);
+#endif
+#ifdef OJPEG_SUPPORT
+extern	int TIFFInitOJPEG(TIFF*, int);
+#endif
+#ifdef JPEG_SUPPORT
+extern	int TIFFInitJPEG(TIFF*, int);
+#endif
+#ifdef JBIG_SUPPORT
+extern	int TIFFInitJBIG(TIFF*, int);
+#endif
+#ifdef ZIP_SUPPORT
+extern	int TIFFInitZIP(TIFF*, int);
+#endif
+#ifdef PIXARLOG_SUPPORT
+extern	int TIFFInitPixarLog(TIFF*, int);
+#endif
+#ifdef LOGLUV_SUPPORT
+extern	int TIFFInitSGILog(TIFF*, int);
+#endif
+#ifdef VMS
+extern	const TIFFCodec _TIFFBuiltinCODECS[];
+#else
+extern	TIFFCodec _TIFFBuiltinCODECS[];
+#endif
+
+#if defined(__cplusplus)
+}
+#endif
+#endif /* _TIFFIOP_ */

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffvers.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffvers.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/tiffvers.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,9 @@
+#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.8.2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
+/*
+ * This define can be used in code that requires
+ * compilation-related definitions specific to a
+ * version or versions of the library.  Runtime
+ * version checking should be done based on the
+ * string returned by TIFFGetVersion.
+ */
+#define TIFFLIB_VERSION 20060323

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/uvcode.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/uvcode.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/uvcode.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,173 @@
+/* Version 1.0 generated April 7, 1997 by Greg Ward Larson, SGI */
+#define UV_SQSIZ	(float)0.003500
+#define UV_NDIVS	16289
+#define UV_VSTART	(float)0.016940
+#define UV_NVS		163
+static struct {
+	float	ustart;
+	short	nus, ncum;
+}	uv_row[UV_NVS] = {
+	(float)0.247663,	4,	0,
+	(float)0.243779,	6,	4,
+	(float)0.241684,	7,	10,
+	(float)0.237874,	9,	17,
+	(float)0.235906,	10,	26,
+	(float)0.232153,	12,	36,
+	(float)0.228352,	14,	48,
+	(float)0.226259,	15,	62,
+	(float)0.222371,	17,	77,
+	(float)0.220410,	18,	94,
+	(float)0.214710,	21,	112,
+	(float)0.212714,	22,	133,
+	(float)0.210721,	23,	155,
+	(float)0.204976,	26,	178,
+	(float)0.202986,	27,	204,
+	(float)0.199245,	29,	231,
+	(float)0.195525,	31,	260,
+	(float)0.193560,	32,	291,
+	(float)0.189878,	34,	323,
+	(float)0.186216,	36,	357,
+	(float)0.186216,	36,	393,
+	(float)0.182592,	38,	429,
+	(float)0.179003,	40,	467,
+	(float)0.175466,	42,	507,
+	(float)0.172001,	44,	549,
+	(float)0.172001,	44,	593,
+	(float)0.168612,	46,	637,
+	(float)0.168612,	46,	683,
+	(float)0.163575,	49,	729,
+	(float)0.158642,	52,	778,
+	(float)0.158642,	52,	830,
+	(float)0.158642,	52,	882,
+	(float)0.153815,	55,	934,
+	(float)0.153815,	55,	989,
+	(float)0.149097,	58,	1044,
+	(float)0.149097,	58,	1102,
+	(float)0.142746,	62,	1160,
+	(float)0.142746,	62,	1222,
+	(float)0.142746,	62,	1284,
+	(float)0.138270,	65,	1346,
+	(float)0.138270,	65,	1411,
+	(float)0.138270,	65,	1476,
+	(float)0.132166,	69,	1541,
+	(float)0.132166,	69,	1610,
+	(float)0.126204,	73,	1679,
+	(float)0.126204,	73,	1752,
+	(float)0.126204,	73,	1825,
+	(float)0.120381,	77,	1898,
+	(float)0.120381,	77,	1975,
+	(float)0.120381,	77,	2052,
+	(float)0.120381,	77,	2129,
+	(float)0.112962,	82,	2206,
+	(float)0.112962,	82,	2288,
+	(float)0.112962,	82,	2370,
+	(float)0.107450,	86,	2452,
+	(float)0.107450,	86,	2538,
+	(float)0.107450,	86,	2624,
+	(float)0.107450,	86,	2710,
+	(float)0.100343,	91,	2796,
+	(float)0.100343,	91,	2887,
+	(float)0.100343,	91,	2978,
+	(float)0.095126,	95,	3069,
+	(float)0.095126,	95,	3164,
+	(float)0.095126,	95,	3259,
+	(float)0.095126,	95,	3354,
+	(float)0.088276,	100,	3449,
+	(float)0.088276,	100,	3549,
+	(float)0.088276,	100,	3649,
+	(float)0.088276,	100,	3749,
+	(float)0.081523,	105,	3849,
+	(float)0.081523,	105,	3954,
+	(float)0.081523,	105,	4059,
+	(float)0.081523,	105,	4164,
+	(float)0.074861,	110,	4269,
+	(float)0.074861,	110,	4379,
+	(float)0.074861,	110,	4489,
+	(float)0.074861,	110,	4599,
+	(float)0.068290,	115,	4709,
+	(float)0.068290,	115,	4824,
+	(float)0.068290,	115,	4939,
+	(float)0.068290,	115,	5054,
+	(float)0.063573,	119,	5169,
+	(float)0.063573,	119,	5288,
+	(float)0.063573,	119,	5407,
+	(float)0.063573,	119,	5526,
+	(float)0.057219,	124,	5645,
+	(float)0.057219,	124,	5769,
+	(float)0.057219,	124,	5893,
+	(float)0.057219,	124,	6017,
+	(float)0.050985,	129,	6141,
+	(float)0.050985,	129,	6270,
+	(float)0.050985,	129,	6399,
+	(float)0.050985,	129,	6528,
+	(float)0.050985,	129,	6657,
+	(float)0.044859,	134,	6786,
+	(float)0.044859,	134,	6920,
+	(float)0.044859,	134,	7054,
+	(float)0.044859,	134,	7188,
+	(float)0.040571,	138,	7322,
+	(float)0.040571,	138,	7460,
+	(float)0.040571,	138,	7598,
+	(float)0.040571,	138,	7736,
+	(float)0.036339,	142,	7874,
+	(float)0.036339,	142,	8016,
+	(float)0.036339,	142,	8158,
+	(float)0.036339,	142,	8300,
+	(float)0.032139,	146,	8442,
+	(float)0.032139,	146,	8588,
+	(float)0.032139,	146,	8734,
+	(float)0.032139,	146,	8880,
+	(float)0.027947,	150,	9026,
+	(float)0.027947,	150,	9176,
+	(float)0.027947,	150,	9326,
+	(float)0.023739,	154,	9476,
+	(float)0.023739,	154,	9630,
+	(float)0.023739,	154,	9784,
+	(float)0.023739,	154,	9938,
+	(float)0.019504,	158,	10092,
+	(float)0.019504,	158,	10250,
+	(float)0.019504,	158,	10408,
+	(float)0.016976,	161,	10566,
+	(float)0.016976,	161,	10727,
+	(float)0.016976,	161,	10888,
+	(float)0.016976,	161,	11049,
+	(float)0.012639,	165,	11210,
+	(float)0.012639,	165,	11375,
+	(float)0.012639,	165,	11540,
+	(float)0.009991,	168,	11705,
+	(float)0.009991,	168,	11873,
+	(float)0.009991,	168,	12041,
+	(float)0.009016,	170,	12209,
+	(float)0.009016,	170,	12379,
+	(float)0.009016,	170,	12549,
+	(float)0.006217,	173,	12719,
+	(float)0.006217,	173,	12892,
+	(float)0.005097,	175,	13065,
+	(float)0.005097,	175,	13240,
+	(float)0.005097,	175,	13415,
+	(float)0.003909,	177,	13590,
+	(float)0.003909,	177,	13767,
+	(float)0.002340,	177,	13944,
+	(float)0.002389,	170,	14121,
+	(float)0.001068,	164,	14291,
+	(float)0.001653,	157,	14455,
+	(float)0.000717,	150,	14612,
+	(float)0.001614,	143,	14762,
+	(float)0.000270,	136,	14905,
+	(float)0.000484,	129,	15041,
+	(float)0.001103,	123,	15170,
+	(float)0.001242,	115,	15293,
+	(float)0.001188,	109,	15408,
+	(float)0.001011,	103,	15517,
+	(float)0.000709,	97,	15620,
+	(float)0.000301,	89,	15717,
+	(float)0.002416,	82,	15806,
+	(float)0.003251,	76,	15888,
+	(float)0.003246,	69,	15964,
+	(float)0.004141,	62,	16033,
+	(float)0.005963,	55,	16095,
+	(float)0.008839,	47,	16150,
+	(float)0.010490,	40,	16197,
+	(float)0.016994,	31,	16237,
+	(float)0.023659,	21,	16268,
+};

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/include/xtiffio.h
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/include/xtiffio.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/include/xtiffio.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,72 @@
+/*
+ *  xtiffio.h -- Public interface to Extended GEO TIFF tags
+ *
+ *    written by: Niles D. Ritter
+ */
+
+#ifndef __xtiffio_h
+#define __xtiffio_h
+
+#include "cpl_serv.h"
+#include "tiffio.h"
+
+/**
+ * \file xtiffio.h
+ *
+ * Definitions relating GeoTIFF functions from geotiff.h to the TIFF
+ * library (usually libtiff).
+ */
+
+/* 
+ *  Define public Tag names and values here 
+ */
+
+/* tags 33550 is a private tag registered to SoftDesk, Inc */
+#define TIFFTAG_GEOPIXELSCALE       33550
+/* tags 33920-33921 are private tags registered to Intergraph, Inc */
+#define TIFFTAG_INTERGRAPH_MATRIX    33920   /* $use TIFFTAG_GEOTRANSMATRIX ! */
+#define TIFFTAG_GEOTIEPOINTS         33922
+/* tags 34263-34264 are private tags registered to NASA-JPL Carto Group */
+#ifdef JPL_TAG_SUPPORT
+#define TIFFTAG_JPL_CARTO_IFD        34263    /* $use GeoProjectionInfo ! */
+#endif
+#define TIFFTAG_GEOTRANSMATRIX       34264    /* New Matrix Tag replaces 33920 */
+/* tags 34735-3438 are private tags registered to SPOT Image, Inc */
+#define TIFFTAG_GEOKEYDIRECTORY      34735
+#define TIFFTAG_GEODOUBLEPARAMS      34736
+#define TIFFTAG_GEOASCIIPARAMS       34737
+
+/* 
+ *  Define Printing method flags. These
+ *  flags may be passed in to TIFFPrintDirectory() to
+ *  indicate that those particular field values should
+ *  be printed out in full, rather than just an indicator
+ *  of whether they are present or not.
+ */
+#define	TIFFPRINT_GEOKEYDIRECTORY	0x80000000
+#define	TIFFPRINT_GEOKEYPARAMS		0x40000000
+
+/**********************************************************************
+ *    Nothing below this line should need to be changed by the user.
+ **********************************************************************/
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+extern TIFF CPL_DLL * XTIFFOpen(const char* name, const char* mode);
+extern TIFF CPL_DLL * XTIFFFdOpen(int fd, const char* name, const char* mode);
+extern void CPL_DLL XTIFFClose(TIFF *tif);
+
+extern TIFF CPL_DLL * XTIFFClientOpen(const char* name, const char* mode, 
+                                      thandle_t thehandle,
+                                      TIFFReadWriteProc, TIFFReadWriteProc,
+                                      TIFFSeekProc, TIFFCloseProc,
+                                      TIFFSizeProc,
+                                      TIFFMapFileProc, TIFFUnmapFileProc);
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __xtiffio_h */
+

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/lib/geotiff_i.lib
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/lib/geotiff_i.lib
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff-bcc.lib
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff-bcc.lib
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff.def
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff.def	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff.def	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,154 @@
+; g:\mingw\3.3.1\bin\dlltool.exe --output-def=libtiff.def tif_aux.o tif_close.o tif_codec.o tif_color.o tif_compress.o tif_dir.o tif_dirinfo.o tif_dirread.o tif_dirwrite.o tif_dumpmode.o tif_error.o tif_extension.o tif_fax3.o tif_fax3sm.o tif_flush.o tif_getimage.o tif_jpeg.o tif_luv.o tif_lzw.o tif_next.o tif_ojpeg.o tif_open.o tif_packbits.o tif_pixarlog.o tif_predict.o tif_print.o tif_read.o tif_strip.o tif_swab.o tif_thunder.o tif_tile.o tif_unix.o tif_version.o tif_warning.o tif_write.o tif_zip.o libtiff-dllversion.o libtiff-dll-res.o
+EXPORTS
+	DllGetVersion @ 1 ; 
+	LogL10fromY @ 2 ; 
+	LogL10toY @ 3 ; 
+	LogL16fromY @ 4 ; 
+	LogL16toY @ 5 ; 
+	LogLuv24fromXYZ @ 6 ; 
+	LogLuv24toXYZ @ 7 ; 
+	LogLuv32fromXYZ @ 8 ; 
+	LogLuv32toXYZ @ 9 ; 
+	TIFFAccessTagMethods @ 10 ; 
+	TIFFCIELabToRGBInit @ 11 ; 
+	TIFFCIELabToXYZ @ 12 ; 
+	TIFFCheckTile @ 13 ; 
+	TIFFCheckpointDirectory @ 14 ; 
+	TIFFCleanup @ 15 ; 
+	TIFFClientOpen @ 16 ; 
+	TIFFClientdata @ 17 ; 
+	TIFFClose @ 18 ; 
+	TIFFComputeStrip @ 19 ; 
+	TIFFComputeTile @ 20 ; 
+	TIFFCreateDirectory @ 21 ; 
+	TIFFCurrentDirOffset @ 22 ; 
+	TIFFCurrentDirectory @ 23 ; 
+	TIFFCurrentRow @ 24 ; 
+	TIFFCurrentStrip @ 25 ; 
+	TIFFCurrentTile @ 26 ; 
+	TIFFDataWidth @ 27 ; 
+	TIFFDefaultStripSize @ 28 ; 
+	TIFFDefaultTileSize @ 29 ; 
+	TIFFError @ 30 ; 
+	TIFFErrorExt @ 31 ; 
+	TIFFFdOpen @ 32 ; 
+	TIFFFieldWithName @ 33 ; 
+	TIFFFieldWithTag @ 34 ; 
+	TIFFFileName @ 35 ; 
+	TIFFFileno @ 36 ; 
+	TIFFFindCODEC @ 37 ; 
+	TIFFFindFieldInfo @ 38 ; 
+	TIFFFindFieldInfoByName @ 39 ; 
+	TIFFFlush @ 40 ; 
+	TIFFFlushData @ 41 ; 
+	TIFFFreeDirectory @ 42 ; 
+	TIFFGetBitRevTable @ 43 ; 
+	TIFFGetClientInfo @ 44 ; 
+	TIFFGetCloseProc @ 45 ; 
+	TIFFGetConfiguredCODECs @ 46 ; 
+	TIFFGetField @ 47 ; 
+	TIFFGetFieldDefaulted @ 48 ; 
+	TIFFGetMapFileProc @ 49 ; 
+	TIFFGetMode @ 50 ; 
+	TIFFGetReadProc @ 51 ; 
+	TIFFGetSeekProc @ 52 ; 
+	TIFFGetSizeProc @ 53 ; 
+	TIFFGetTagListCount @ 54 ; 
+	TIFFGetTagListEntry @ 55 ; 
+	TIFFGetUnmapFileProc @ 56 ; 
+	TIFFGetVersion @ 57 ; 
+	TIFFGetWriteProc @ 58 ; 
+	TIFFIsBigEndian @ 59 ; 
+	TIFFIsByteSwapped @ 60 ; 
+	TIFFIsCODECConfigured @ 61 ; 
+	TIFFIsMSB2LSB @ 62 ; 
+	TIFFIsTiled @ 63 ; 
+	TIFFIsUpSampled @ 64 ; 
+	TIFFLastDirectory @ 65 ; 
+	TIFFMergeFieldInfo @ 66 ; 
+	TIFFNumberOfDirectories @ 67 ; 
+	TIFFNumberOfStrips @ 68 ; 
+	TIFFNumberOfTiles @ 69 ; 
+	TIFFOpen @ 70 ; 
+	TIFFOpenW @ 71 ; 
+	TIFFPrintDirectory @ 72 ; 
+	TIFFRGBAImageBegin @ 73 ; 
+	TIFFRGBAImageEnd @ 74 ; 
+	TIFFRGBAImageGet @ 75 ; 
+	TIFFRGBAImageOK @ 76 ; 
+	TIFFRasterScanlineSize @ 77 ; 
+	TIFFRawStripSize @ 78 ; 
+	TIFFReadBufferSetup @ 79 ; 
+	TIFFReadCustomDirectory @ 80 ; 
+	TIFFReadDirectory @ 81 ; 
+	TIFFReadEXIFDirectory @ 82 ; 
+	TIFFReadEncodedStrip @ 83 ; 
+	TIFFReadEncodedTile @ 84 ; 
+	TIFFReadRGBAImage @ 85 ; 
+	TIFFReadRGBAImageOriented @ 86 ; 
+	TIFFReadRGBAStrip @ 87 ; 
+	TIFFReadRGBATile @ 88 ; 
+	TIFFReadRawStrip @ 89 ; 
+	TIFFReadRawTile @ 90 ; 
+	TIFFReadScanline @ 91 ; 
+	TIFFReadTile @ 92 ; 
+	TIFFReassignTagToIgnore @ 93 ; 
+	TIFFRegisterCODEC @ 94 ; 
+	TIFFReverseBits @ 95 ; 
+	TIFFRewriteDirectory @ 96 ; 
+	TIFFScanlineSize @ 97 ; 
+	TIFFSetClientInfo @ 98 ; 
+	TIFFSetClientdata @ 99 ; 
+	TIFFSetDirectory @ 100 ; 
+	TIFFSetErrorHandler @ 101 ; 
+	TIFFSetErrorHandlerExt @ 102 ; 
+	TIFFSetField @ 103 ; 
+	TIFFSetFileName @ 104 ; 
+	TIFFSetFileno @ 105 ; 
+	TIFFSetMode @ 106 ; 
+	TIFFSetSubDirectory @ 107 ; 
+	TIFFSetTagExtender @ 108 ; 
+	TIFFSetWarningHandler @ 109 ; 
+	TIFFSetWarningHandlerExt @ 110 ; 
+	TIFFSetWriteOffset @ 111 ; 
+	TIFFSetupStrips @ 112 ; 
+	TIFFStripSize @ 113 ; 
+	TIFFSwabArrayOfDouble @ 114 ; 
+	TIFFSwabArrayOfLong @ 115 ; 
+	TIFFSwabArrayOfShort @ 116 ; 
+	TIFFSwabArrayOfTriples @ 117 ; 
+	TIFFSwabDouble @ 118 ; 
+	TIFFSwabLong @ 119 ; 
+	TIFFSwabShort @ 120 ; 
+	TIFFTileRowSize @ 121 ; 
+	TIFFTileSize @ 122 ; 
+	TIFFUnRegisterCODEC @ 123 ; 
+	TIFFUnlinkDirectory @ 124 ; 
+	TIFFVGetField @ 125 ; 
+	TIFFVGetFieldDefaulted @ 126 ; 
+	TIFFVSetField @ 127 ; 
+	TIFFVStripSize @ 128 ; 
+	TIFFVTileSize @ 129 ; 
+	TIFFWarning @ 130 ; 
+	TIFFWarningExt @ 131 ; 
+	TIFFWriteBufferSetup @ 132 ; 
+	TIFFWriteCheck @ 133 ; 
+	TIFFWriteDirectory @ 134 ; 
+	TIFFWriteEncodedStrip @ 135 ; 
+	TIFFWriteEncodedTile @ 136 ; 
+	TIFFWriteRawStrip @ 137 ; 
+	TIFFWriteRawTile @ 138 ; 
+	TIFFWriteScanline @ 139 ; 
+	TIFFWriteTile @ 140 ; 
+	TIFFXYZToRGB @ 141 ; 
+	TIFFYCbCrToRGBInit @ 142 ; 
+	TIFFYCbCrtoRGB @ 143 ; 
+	XYZtoRGB24 @ 144 ; 
+	_TIFFfree @ 145 ; 
+	_TIFFmalloc @ 146 ; 
+	_TIFFmemcmp @ 147 ; 
+	_TIFFmemcpy @ 148 ; 
+	_TIFFmemset @ 149 ; 
+	_TIFFrealloc @ 150 ; 
+	uv_decode @ 151 ; 
+	uv_encode @ 152 ; 

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff.dll.a
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff.dll.a
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff.lib
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff.lib
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff_i.lib
===================================================================
(Binary files differ)


Property changes on: branches/gSoC2007_raster/pgraster/win32/dep-package/lib/libtiff_i.lib
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/manifest/tiff-3.8.2-1-lib.mft
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/manifest/tiff-3.8.2-1-lib.mft	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/manifest/tiff-3.8.2-1-lib.mft	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1,10 @@
+include/tiff.h
+include/tiffconf.h
+include/tiffio.h
+include/tiffvers.h
+lib/libtiff-bcc.lib
+lib/libtiff.def
+lib/libtiff.dll.a
+lib/libtiff.lib
+manifest/tiff-3.8.2-1-lib.mft
+manifest/tiff-3.8.2-1-lib.ver

Added: branches/gSoC2007_raster/pgraster/win32/dep-package/manifest/tiff-3.8.2-1-lib.ver
===================================================================
--- branches/gSoC2007_raster/pgraster/win32/dep-package/manifest/tiff-3.8.2-1-lib.ver	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/win32/dep-package/manifest/tiff-3.8.2-1-lib.ver	2007-08-17 22:46:15 UTC (rev 2696)
@@ -0,0 +1 @@
+Tiff-3.8.2: Developer files

Modified: branches/gSoC2007_raster/pgraster/wkb.c
===================================================================
--- branches/gSoC2007_raster/pgraster/wkb.c	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/wkb.c	2007-08-17 22:46:15 UTC (rev 2696)
@@ -37,21 +37,28 @@
 
 void* generic_alloc(size_t size)
 {
+	/*
 	#ifdef POSTGRESQL_ALLOC 	
 		return palloc(size);	//PostgreSQL Alloc
 	#else
 		return (void*)malloc(size); // C Language Library Mallloc
 	#endif	
+	*/
+	return (void*)malloc(size); // C Language Library Mallloc
 }
 
 void generic_free(void* p)
 {
+	/*
 	#ifdef POSTGRESQL_ALLOC 	
 		pfree(p);// PostgreSQL Free
 	#else
 		free(p);// C Language Library Free
 		return;
 	#endif	
+	*/
+	free(p);// C Language Library Free
+	return;
 }
 
 
@@ -72,7 +79,7 @@
 		case wkbPolygon :
 		{
 			WKSLinearRing	*pRing = G_SeekFirstRing(pObj);
-			uint32			i;
+			_uint32			i;
 			nSize = sizeof(WKBPolygon);
 
 			for (i = 0; i < pObj->polygon.numRings; i++)
@@ -91,7 +98,7 @@
 		case wkbMultiPoint :
 		{
 			WKBGeometry		*pTraceObj = G_SeekFirstGeometry(pObj);
-			uint32			i;
+			_uint32			i;
 			nSize = sizeof(WKBGeometryCollection);
 			
 			for (i = 0; i < pObj->collection.num_wkbGeometries; i++)
@@ -175,7 +182,7 @@
 
 WKBGeometry* G_CreatePolygon_Simple(long nCount, const WKSPoint *pPoints)
 {
-	uint32			nSize = sizeof(WKBPolygon);
+	_uint32			nSize = sizeof(WKBPolygon);
 	byte*			p;
 	WKBPolygon*		pObj;
 	WKSLinearRing	*pRing;
@@ -298,7 +305,7 @@
 		case wkbMultiPolygon    :
 		case wkbGeometryCollection    :
 		{
-			uint32			i;
+			_uint32			i;
 			WKSEnvelope		mbr;
 			WKSEnvelope*		pMbrTemp;
 			WKBGeometry*	pSub = G_SeekFirstGeometry(pObj);

Modified: branches/gSoC2007_raster/pgraster/wkb.h
===================================================================
--- branches/gSoC2007_raster/pgraster/wkb.h	2007-08-17 18:33:58 UTC (rev 2695)
+++ branches/gSoC2007_raster/pgraster/wkb.h	2007-08-17 22:46:15 UTC (rev 2696)
@@ -33,7 +33,6 @@
 #ifndef _WKB_H
 #define _WKB_H 1
 #include <inttypes.h>
-
 /*
  * OGC WellKnownBinaryGeometry
  */
@@ -50,9 +49,11 @@
 
 #ifndef _UINT32
 #define _UINT32 1
-typedef uint32_t uint32;
+typedef uint32_t _uint32;
 #endif
 
+
+
 #pragma pack(1)
 
 //#pragma warning(disable:4200)			// ignore zero-sized array in struct/union
@@ -73,68 +74,68 @@
 
 typedef struct
 {
-	uint32	    numPoints;
+	_uint32	    numPoints;
 	WKSPoint	points[0];
 } WKSLinearRing;
 
 typedef struct
 {
 	byte		byteOrder;
-	uint32		wkbType;
+	_uint32		wkbType;
 } WKBObject;
 
 typedef struct
 {
 	byte	    byteOrder;
-	uint32	    wkbType;
+	_uint32	    wkbType;
 	WKSPoint	point;
 } WKBPoint;
 
 typedef struct
 {
 	byte	    byteOrder;
-	uint32	    wkbType;
-	uint32	    numPoints;
+	_uint32	    wkbType;
+	_uint32	    numPoints;
 	WKSPoint	points[0];
 } WKBLineString;
 
 typedef struct
 {
 	byte	    byteOrder;
-	uint32	    wkbType;
-	uint32	    numRings;
+	_uint32	    wkbType;
+	_uint32	    numRings;
 	//WKSLinearRing	rings[0];
 } WKBPolygon;
 
 typedef struct
 {
 	byte		byteOrder;
-	uint32		wkbType;
-	uint32		num_wkbPoints;
+	_uint32		wkbType;
+	_uint32		num_wkbPoints;
 	WKBPoint    WKBPoints[0];
 } WKBMultiPoint;
 
 typedef struct
 {
 	byte			byteOrder;
-	uint32			wkbType;
-	uint32			num_wkbLineStrings;
+	_uint32			wkbType;
+	_uint32			num_wkbLineStrings;
 //	WKBLineString   WKBLineStrings[0];
 } WKBMultiLineString;
 
 typedef struct
 {
 	byte		    byteOrder;
-	uint32		    wkbType;
-	uint32		    num_wkbPolygons;
+	_uint32		    wkbType;
+	_uint32		    num_wkbPolygons;
 //	WKBPolygon		wkbPolygons[0];
 } WKBMultiPolygon;
 
 typedef struct
 {
 	byte		    byteOrder;
-	uint32		    wkbType;
-	uint32		    num_wkbGeometries;
+	_uint32		    wkbType;
+	_uint32		    num_wkbGeometries;
 	//	WKBGeomertry    wkbGeometries[0];
 } WKBGeometryCollection;
 



More information about the postgis-commits mailing list