[GRASS5] readsites() TODO list...

Eric G . Miller egm2 at jps.net
Wed Sep 20 06:09:24 EDT 2000


A week or so ago, I looked at the TODO list and thought I'd look into
this readsite() library function.  I arrived at the conclusion that the
call would have to be different to support reading z-dim, double-att, or
strtod(string-att), for generating an *xyz struct.  Anyway, I already
did one iteration that added support for the z-dim, but I wanted to put
up this call interface for comments.  We could make it a readsites2()
and retain the other interface for awhile.  I don't know how many
modules actually use readsites() at the moment.  Anyway, please let me
know if the behaviors described here look awful (I'm still new to coding
for GRASS).


/* readsites: Reads a sites file converting to a site struct of xyz values.
 * The Z value can come from one of the z-dimensions, a double attribute,
 * or a string attribute converted to a double with strtod().
 * If 'num' is less than one, attempt to read entire site file, otherwise
 * read 'num' records.  The number of records read is returned.  If an
 * error occurs, a negative value is returned.  The caller can decide to
 * abort or retry.  Error values are:
 *	Couldn't allocate memory  				-1
 *	Attribute 'type' not found				-2
 *      Attribute 'index' out of range				-3
 *	Format error in file (includes conversion error)	-4
 *	Something else (probably never happen)  		-5
 */

typedef struct _site {
	double x, y, z;
} site;

int readsites( 
	FILE * fdsite,  /* The FILE stream to the sites file */
	int    num,     /* Number of records to read */
	int    type,    /* Attribute type: 0 = Z-dim, 1 = double, 2 = string */
	int    index,   /* The field index (1 based) for the attribute */
	int  * done,    /* No more records in file? 0 = false, 1 = true */
	site **xyz      /* The site array, caller must free between calls */
	);
	


-- 
/bin/sh ~/.signature:
Command not found
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20000920/6bcca61a/attachment.bin


More information about the grass-dev mailing list