14#define DATUMTABLE "/etc/proj/datum.table"
38static int compare_table_names(
const void *,
const void *);
46 for (i = 0; i < table.count; i++)
60 return table.datums[n].
name;
70 return table.datums[n].descr;
80 return table.datums[n].ellps;
157 for (line = 1;
G_getl2(buf,
sizeof(buf), fd); line++) {
158 char name[100], descr[100], ellps[100];
162 if (*buf ==
'\0' || *buf ==
'#')
165 if (table.count >= table.size) {
168 G_realloc(table.datums, table.size *
sizeof(
struct datum));
171 t = &table.datums[table.count];
173 if (
sscanf(buf,
"%s \"%99[^\"]\" %s dx=%lf dy=%lf dz=%lf",
name, descr,
174 ellps, &
t->dx, &
t->dy, &
t->dz) != 6) {
175 G_warning(
_(
"error in datum table file, line %d"), line);
186 qsort(table.datums, table.count,
sizeof(
struct datum), compare_table_names);
192static int compare_table_names(
const void *
aa,
const void *
bb)
194 const struct datum *a =
aa;
195 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)