17#define DATUMTABLE "/etc/proj/datum.table"
41static int compare_table_names(
const void *,
const void *);
49 for (i = 0; i < table.count; i++)
63 return table.datums[n].
name;
73 return table.datums[n].descr;
83 return table.datums[n].ellps;
160 for (line = 1;
G_getl2(buf,
sizeof(buf), fd); line++) {
161 char name[100], descr[100], ellps[100];
165 if (*buf ==
'\0' || *buf ==
'#')
168 if (table.count >= table.size) {
171 G_realloc(table.datums, table.size *
sizeof(
struct datum));
174 t = &table.datums[table.count];
176 if (
sscanf(buf,
"%s \"%99[^\"]\" %s dx=%lf dy=%lf dz=%lf",
name, descr,
177 ellps, &
t->dx, &
t->dy, &
t->dz) != 6) {
178 G_warning(
_(
"error in datum table file, line %d"), line);
189 qsort(table.datums, table.count,
sizeof(
struct datum), compare_table_names);
195static int compare_table_names(
const void *
aa,
const void *
bb)
197 const struct datum *a =
aa;
198 const struct datum *
b =
bb;
AMI_err name(char **stream_name)
int G_getl2(char *, int, FILE *)
Gets a line of text from a file of any pedigree.
void G_warning(const char *,...) __attribute__((format(printf
const char * G_gisbase(void)
Get full path name of the top level module directory.
void G_strip(char *)
Removes all leading and trailing white space from string.
const char * G_find_key_value(const char *, const struct Key_Value *)
Find given key (case sensitive)
int G_is_initialized(int *)
void G_initialize_done(int *)
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
char * G_store(const char *)
Copy string to allocated memory.
const char * G_datum_description(int n)
int G_get_datumparams_from_projinfo(const struct Key_Value *projinfo, char *datumname, char *params)
int G_get_datum_by_name(const char *name)
void G_read_datum_table(void)
const char * G_datum_ellipsoid(int n)
const char * G_datum_name(int n)