[GRASS5] Does this G_readsites_xyz() meet peoples needs?

Okay, I've modified the G_readsites() function to G_readsites_xyz() with
the API below. I tested out the implementation and it works okay. So if
nobody objects in the next couple days, I'll add the header to site.h
and put the implementation into the libgis.a.

Basically, you'd use the G_alloc_site_xyz() to allocate an array of
SITE_XYZ struct (or just allocate a fixed array), then make iterative
calls until the number of records returned is less than the size of the
array, or EOF is returned. Finally free the dynamically allocated array
(if you used G_alloc_site_xyz()) with G_free_site_xyz().

The current implementation just dies if there are any conversion or
index errors. This implies that site_lists must not have missing
dimensions or attributes for any of the records. Lack of a category
value will have 'cattype' set to the same value set by G_site_get().

## Modifications for site.h ##

/* Some defines for which column type to use */
#define SITE_COL_DIM 1
#define SITE_COL_DBL 2
#define SITE_COL_STR 3

/* The XYZ site struct. Note the use of a union for the cat value is
* different than the Site struct.
*/
typedef struct {
  double x, y, z;
  RASTER_MAP_TYPE cattype;
  union {
    double d;
    float f;
    int c;
  } cat ;
} SITE_XYZ;

/* Allocate 'num' SITE_XYZ structs. Returns NULL on failure */
SITE_XYZ * G_alloc_site_xyz(size_t num);

/* Free the array of SITE_XYZ struct */
void G_free_site_xyz(SITE_XYZ *theSites);

/* G_readsites_xyz: Reads a sites file converting to a site struct of xyz
* values and the cat value. The Z value can come from one of the
* n-dimensions, a double attribute, or a string attribute converted to a
* double with strtod(). The 'size' must not be greater than the number
* of elements in the SITE_XYZ array, or bad things will happen. The number
* of records read is returned or EOF on end of file. NOTE: EOF won't be
* returned unless no records are read and the EOF bit is set. It's safe
* to assume that if the number of records read is less than the size of
* the array, that there aren't any more records.
*/
int G_readsites_xyz(
  FILE * fdsite, /* The FILE stream to the sites file */
  int type, /* Attribute type: SITE_COL_DIM, etc... */
  int index, /* The field index (1 based) for the attribute */
  int size, /* Size of the array */
  SITE_XYZ *xyz /* The site array of size 'size' */
  );

--
/bin/sh ~/.signature:
Command not found

Hi all,

good news: tcltkgrass seems to work o.k. with any tcl/tk version
(I added a missing fix on Friday).

But I cannot manage to compile NVIZ (after setting the src/Gmakefile
to tcl/tk 8.3):

OBJ.i686-pc-linux-gnu/nvizMain.o: In function `main':
/home/neteler/ggg/src.contrib/GMSL/NVIZ2.2/src/nvizMain.c:43: undefined
reference to `Tk_Main'
collect2: ld returned 1 exit status
make: *** [nvwish] Error 1

.. I need a tcl-guru...

Another general problem is there: Shall we link the tcl/tk libs
static into the GRASS binaries? Otherwise the users using a different
tcl/tk8.x version will run into troubles. Or is there any other option
to fix the mess will the different tcl/tk8. versions?

Regards

Markus

----------------------------------------
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo@geog.uni-hannover.de with
subject 'unsubscribe grass5'