19 #include <grass/gis.h>
20 #include <grass/Vect.h>
24 unsigned char buf[10];
25 long length = GV_COOR_HEAD_SIZE;
27 G_debug(1,
"dig__write_head()");
33 buf[0] = Map->head.Version_Major;
34 buf[1] = Map->head.Version_Minor;
35 buf[2] = Map->head.Back_Major;
36 buf[3] = Map->head.Back_Minor;
38 buf[4] = Map->head.port.byte_order;
47 buf[0] = Map->head.with_z;
52 G_debug(1,
"write coor size (%ld) to head", Map->head.size);
63 unsigned char buf[10];
64 struct Port_info port;
71 Map->head.Version_Major = buf[0];
72 Map->head.Version_Minor = buf[1];
73 Map->head.Back_Major = buf[2];
74 Map->head.Back_Minor = buf[3];
75 Map->head.port.byte_order = buf[4];
78 "Coor header: file version %d.%d , supported from GRASS version %d.%d",
79 Map->head.Version_Major, Map->head.Version_Minor,
80 Map->head.Back_Major, Map->head.Back_Minor);
82 G_debug(2,
" byte order %d", Map->head.port.byte_order);
85 if (Map->head.Version_Major > GV_COOR_VER_MAJOR ||
86 Map->head.Version_Minor > GV_COOR_VER_MINOR) {
89 if (Map->head.Back_Major > GV_COOR_VER_MAJOR ||
90 Map->head.Back_Minor > GV_COOR_VER_MINOR) {
93 (
"Vector 'coor' format version %d.%d is not supported by this version of GRASS. "
94 "Update your GRASS.", Map->head.Version_Major,
95 Map->head.Version_Minor);
100 (
"Your GRASS version does not fully support vector format %d.%d."
101 " Consider to upgrade GRASS.", Map->head.Version_Major,
102 Map->head.Version_Minor);
111 G_debug(2,
" header size %ld", Map->head.head_size);
116 Map->head.with_z = buf[0];
117 G_debug(2,
" with_z %d", Map->head.with_z);
122 G_debug(2,
" coor size %ld", Map->head.size);
126 dig_fseek(&(Map->dig_fp), Map->head.head_size, SEEK_SET);
int dig_set_cur_port(struct Port_info *port)
int dig__read_head(struct Map_info *Map)
void dig_init_portable(struct Port_info *port, int byte_order)
int dig__fread_port_L(long *buf, int cnt, GVFILE *fp)
int dig_fseek(GVFILE *file, long offset, int whence)
Set GVFILE position.
int dig__fwrite_port_L(long *buf, int cnt, GVFILE *fp)
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
int dig__fread_port_C(char *buf, int cnt, GVFILE *fp)
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int G_debug(int level, const char *msg,...)
Print debugging message.
int dig__fwrite_port_C(char *buf, int cnt, GVFILE *fp)
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
long dig_ftell(GVFILE *file)
Get GVFILE position.
int dig__write_head(struct Map_info *Map)