[GRASS-SVN] r36391 - in grass/trunk/include: . vect

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 16 05:49:17 EDT 2009


Author: mmetz
Date: 2009-03-16 05:49:17 -0400 (Mon, 16 Mar 2009)
New Revision: 36391

Modified:
   grass/trunk/include/Vect.h
   grass/trunk/include/vect/dig_defines.h
   grass/trunk/include/vect/dig_externs.h
   grass/trunk/include/vect/dig_structs.h
Log:
experimental LFS support for vector libspart 1

Modified: grass/trunk/include/Vect.h
===================================================================
--- grass/trunk/include/Vect.h	2009-03-16 08:19:27 UTC (rev 36390)
+++ grass/trunk/include/Vect.h	2009-03-16 09:49:17 UTC (rev 36391)
@@ -222,7 +222,7 @@
 /* Level 1 and 2 */
 int Vect_read_next_line(struct Map_info *, struct line_pnts *,
 			struct line_cats *);
-long Vect_write_line(struct Map_info *, int, struct line_pnts *,
+off_t Vect_write_line(struct Map_info *, int, struct line_pnts *,
 		     struct line_cats *);
 
 int Vect_get_num_dblinks(struct Map_info *);
@@ -233,7 +233,7 @@
 int Vect_rewrite_line(struct Map_info *, int, int, struct line_pnts *,
 		      struct line_cats *);
 int Vect_delete_line(struct Map_info *, int);
-int Vect_restore_line(struct Map_info *, int, long);
+int Vect_restore_line(struct Map_info *, int, off_t);
 
 int Vect_line_alive(struct Map_info *, int);
 int Vect_node_alive(struct Map_info *, int);
@@ -241,7 +241,7 @@
 int Vect_isle_alive(struct Map_info *, int);
 int Vect_get_line_nodes(struct Map_info *, int, int *, int *);
 int Vect_get_line_areas(struct Map_info *, int, int *, int *);
-long Vect_get_line_offset(const struct Map_info *, int);
+off_t Vect_get_line_offset(const struct Map_info *, int);
 
 int Vect_get_node_coor(struct Map_info *, int, double *, double *, double *);
 int Vect_get_node_n_lines(struct Map_info *, int);
@@ -421,7 +421,7 @@
 
 /* Read/write lines */
 int V1_read_line_nat(struct Map_info *, struct line_pnts *,
-		     struct line_cats *, long);
+		     struct line_cats *, off_t);
 int V1_read_next_line_nat(struct Map_info *, struct line_pnts *,
 			  struct line_cats *);
 int V1_read_next_line_ogr(struct Map_info *, struct line_pnts *,
@@ -434,19 +434,19 @@
 			  struct line_cats *);
 int V2_read_next_line_ogr(struct Map_info *, struct line_pnts *,
 			  struct line_cats *);
-int V1_delete_line_nat(struct Map_info *, long);
+int V1_delete_line_nat(struct Map_info *, off_t);
 int V2_delete_line_nat(struct Map_info *, int);
-int V1_restore_line_nat(struct Map_info *, long);
-int V2_restore_line_nat(struct Map_info *, int, long);
-long V1_write_line_nat(struct Map_info *, int type, struct line_pnts *,
+int V1_restore_line_nat(struct Map_info *, off_t);
+int V2_restore_line_nat(struct Map_info *, int, off_t);
+off_t V1_write_line_nat(struct Map_info *, int type, struct line_pnts *,
 		       struct line_cats *);
-long V2_write_line_nat(struct Map_info *, int type, struct line_pnts *,
+off_t V2_write_line_nat(struct Map_info *, int type, struct line_pnts *,
 		       struct line_cats *);
 #if 0
 long V1_write_line_ogr(struct Map_info *, int type, struct line_pnts *,
 		       struct line_cats *);
 #endif
-long V1_rewrite_line_nat(struct Map_info *, long offset, int type,
+off_t V1_rewrite_line_nat(struct Map_info *, off_t offset, int type,
 			 struct line_pnts *, struct line_cats *);
 int V2_rewrite_line_nat(struct Map_info *, int line, int type,
 			struct line_pnts *, struct line_cats *);

Modified: grass/trunk/include/vect/dig_defines.h
===================================================================
--- grass/trunk/include/vect/dig_defines.h	2009-03-16 08:19:27 UTC (rev 36390)
+++ grass/trunk/include/vect/dig_defines.h	2009-03-16 09:49:17 UTC (rev 36391)
@@ -27,6 +27,7 @@
 #define PORT_INT    4
 #define PORT_SHORT  2
 #define PORT_CHAR   1
+#define PORT_OFF_T  8
 
 /* replace by PORT_* in Vlib later and remove : */
 #define DBL_SIZ  8

Modified: grass/trunk/include/vect/dig_externs.h
===================================================================
--- grass/trunk/include/vect/dig_externs.h	2009-03-16 08:19:27 UTC (rev 36390)
+++ grass/trunk/include/vect/dig_externs.h	2009-03-16 09:49:17 UTC (rev 36391)
@@ -50,6 +50,7 @@
 
 int dig__fread_port_D(double *, int, GVFILE *);
 int dig__fread_port_F(float *, int, GVFILE *);
+int dig__fread_port_O(off_t *, int, GVFILE *, int);
 int dig__fread_port_L(long *, int, GVFILE *);
 int dig__fread_port_S(short *, int, GVFILE *);
 int dig__fread_port_I(int *, int, GVFILE *);
@@ -57,6 +58,7 @@
 int dig__fread_port_C(char *, int, GVFILE *);
 int dig__fwrite_port_D(double *, int, GVFILE *);
 int dig__fwrite_port_F(float *, int, GVFILE *);
+int dig__fwrite_port_O(off_t *, int, GVFILE *, int);
 int dig__fwrite_port_L(long *, int, GVFILE *);
 int dig__fwrite_port_S(short *, int, GVFILE *);
 int dig__fwrite_port_I(int *, int, GVFILE *);
@@ -125,9 +127,9 @@
 int dig_add_node(struct Plus_head *, double, double, double);
 int dig_which_node(struct Plus_head *, double, double, double);
 int dig_add_line(struct Plus_head *, int, struct line_pnts *,
-		 long);
+		 off_t);
 int dig_restore_line(struct Plus_head *, int, int, struct line_pnts *,
-		     long);
+		     off_t);
 int dig_del_line(struct Plus_head *, int);
 int dig_node_add_line(struct Plus_head *, int, int, struct line_pnts *, int);
 float dig_node_line_angle(struct Plus_head *, int, int);
@@ -238,8 +240,8 @@
 int dig_Wr_Plus_head(GVFILE *, struct Plus_head *);
 
 /* file loaded to memory */
-long dig_ftell(GVFILE * file);
-int dig_fseek(GVFILE * file, long offset, int whence);
+off_t dig_ftell(GVFILE * file);
+int dig_fseek(GVFILE * file, off_t offset, int whence);
 void dig_rewind(GVFILE * file);
 int dig_fflush(GVFILE * file);
 size_t dig_fread(void *ptr, size_t size, size_t nmemb, GVFILE * file);

Modified: grass/trunk/include/vect/dig_structs.h
===================================================================
--- grass/trunk/include/vect/dig_structs.h	2009-03-16 08:19:27 UTC (rev 36390)
+++ grass/trunk/include/vect/dig_structs.h	2009-03-16 09:49:17 UTC (rev 36391)
@@ -12,6 +12,8 @@
 #include <stdio.h>
 #endif
 
+#include <sys/types.h>
+
 #include <grass/dgl.h>
 #include <grass/shapefil.h>
 #include <grass/btree.h>
@@ -66,8 +68,8 @@
     char *start;		/* pointer to beginnig of the file in the memory */
     char *current;		/* current position set by dig_seek */
     char *end;			/* end of file in the memory (pointer to first byte after) */
-    long size;			/* size of the file loaded to memory */
-    long alloc;			/* allocated space */
+    off_t size;			/* size of the file loaded to memory */
+    off_t alloc;		/* allocated space */
     int loaded;			/* 0 - not loaded, 1 - loaded */
 } GVFILE;
 
@@ -101,6 +103,7 @@
     unsigned char lng_cnvrt[PORT_LONG];
     unsigned char int_cnvrt[PORT_INT];
     unsigned char shrt_cnvrt[PORT_SHORT];
+    unsigned char off_t_cnvrt[PORT_OFF_T];
 
     /* *_quick specify if native byte order of that type 
      * is the same as byte order of vector file (TRUE) 
@@ -110,6 +113,7 @@
     int lng_quick;
     int int_quick;
     int shrt_quick;
+    int off_t_quick;
 };
 
 /* List of dead lines in the file, the space can be reused, not yet used */
@@ -145,12 +149,12 @@
     int Back_Minor;
     int with_z;
 
-    long size;			/* coor file size */
+    off_t size;			/* coor file size */
     long head_size;		/* coor header size */
 
     struct Port_info port;	/* Portability information */
 
-    long last_offset;		/* offset of last read line */
+    off_t last_offset;		/* offset of last read line */
 
     struct recycle *recycle;
 
@@ -160,7 +164,7 @@
 /* Coor info */
 struct Coor_info
 {
-    long size;			/* total size, in bytes */
+    off_t size;			/* total size, in bytes */
     long mtime;			/* time of last modification */
 };
 
@@ -229,7 +233,7 @@
     int n_ucats;		/* number of unique cats (not updated) */
     int n_types;		/* number of types in type */
     int type[7][2];		/* number of elements for each type (point, line, boundary, centroid, area, face, kernel) */
-    long offset;		/* offset of the beginning of this index in cidx file */
+    off_t offset;		/* offset of the beginning of this index in cidx file */
 };
 
 struct Plus_head
@@ -252,6 +256,8 @@
     int with_z;
     int spidx_with_z;
 
+    int off_t_size;        /* offset size here because Plus_head is available to all releveant functions */
+
     long head_size;		/* topo header size */
     long spidx_head_size;	/* spatial index header size */
     long cidx_head_size;	/* category index header size */
@@ -296,13 +302,13 @@
     plus_t alloc_volumes;
     plus_t alloc_holes;
 
-    long Node_offset;		/* offset of array of nodes in topo file */
-    long Edge_offset;
-    long Line_offset;
-    long Area_offset;
-    long Isle_offset;
-    long Volume_offset;
-    long Hole_offset;
+    off_t Node_offset;		/* offset of array of nodes in topo file */
+    off_t Edge_offset;
+    off_t Line_offset;
+    off_t Area_offset;
+    off_t Isle_offset;
+    off_t Volume_offset;
+    off_t Hole_offset;
 
     /* Spatial index */
     /* Spatial index is never saved, it is built automaticaly for new and updated vectors.
@@ -311,13 +317,13 @@
 
     int Spidx_built;		/* set to 1 if spatial index is available and to 0 if it is not */
 
-    long Node_spidx_offset;	/* offset of spindex */
-    long Edge_spidx_offset;
-    long Line_spidx_offset;
-    long Area_spidx_offset;
-    long Isle_spidx_offset;
-    long Volume_spidx_offset;
-    long Hole_spidx_offset;
+    off_t Node_spidx_offset;	/* offset of spindex */
+    off_t Edge_spidx_offset;
+    off_t Line_spidx_offset;
+    off_t Area_spidx_offset;
+    off_t Isle_spidx_offset;
+    off_t Volume_spidx_offset;
+    off_t Hole_spidx_offset;
 
     struct Node *Node_spidx;
     struct Node *Line_spidx;
@@ -333,7 +339,7 @@
     struct Cat_index *cidx;	/* Array of category indexes */
     int cidx_up_to_date;	/* set to 1 when cidx is created and reset to 0 whenever any line is changed */
 
-    long coor_size;		/* size of coor file */
+    off_t coor_size;		/* size of coor file */
     long coor_mtime;		/* time of last coor modification */
 
     /* Level2 update: list of lines and nodes updated (topo info for the line was changed) 
@@ -447,7 +453,7 @@
     double T;			/* top */
     double B;			/* bottom */
 
-    long offset;		/* offset in coor file for line */
+    off_t offset;		/* offset in coor file for line */
     int type;
 };
 



More information about the grass-commit mailing list