17 #define DATUMTABLE "/etc/datum.table" 
   24 #include <grass/gis.h> 
   25 #include <grass/glocale.h> 
   38 static int count = -1;
 
   40 static int compare_table_names(
const void *, 
const void *);
 
   41 static void read_datum_table(
void);
 
   49     for (i = 0; i < 
count; i++)
 
   60     if (n < 0 || n >= 
count)
 
   70     if (n < 0 || n >= 
count)
 
   73     return table[
n].descr;
 
   80     if (n < 0 || n >= 
count)
 
   83     return table[
n].ellps;
 
  108                                     char *datumname, 
char *params)
 
  133         sprintf(params, 
"towgs84=%s,%s,%s",
 
  144 static void read_datum_table(
void)
 
  158     fd = fopen(file, 
"r");
 
  160         G_warning(_(
"unable to open datum table file: %s"), file);
 
  164     for (line = 1; 
G_getl2(buf, 
sizeof(buf), fd); line++) {
 
  165         char name[100], descr[100], ellps[100];
 
  169         if (*buf == 
'\0' || *buf == 
'#')
 
  174             table = G_realloc(table, 
size * 
sizeof(
struct table));
 
  179         if (sscanf(buf, 
"%s \"%99[^\"]\" %s dx=%lf dy=%lf dz=%lf",
 
  180                    name, descr, ellps, &t->dx, &t->dy, &t->dz) != 6) {
 
  181             G_warning(_(
"error in datum table file, line %d"), line);
 
  192     qsort(table, 
count, 
sizeof(
struct table), compare_table_names);
 
  195 static int compare_table_names(
const void *aa, 
const void *bb)
 
  197     const struct table *a = aa;
 
  198     const struct table *
b = bb;
 
char * G_find_key_value(const char *key, const struct Key_Value *kv)
Find given key. 
int G_strcasecmp(const char *x, const char *y)
String compare ignoring case (upper or lower) 
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
int G_get_datumparams_from_projinfo(const struct Key_Value *projinfo, char *datumname, char *params)
char * G_store(const char *s)
Copy string to allocated memory. 
char * G_datum_name(int n)
int G_getl2(char *buf, int n, FILE *fd)
gets a line of text from a file of any pedigree 
int G_strip(char *buf)
Removes all leading and trailing white space from string. 
char * G_datum_ellipsoid(int n)
char * G_datum_description(int n)
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
char * G_gisbase(void)
top level module directory 
int G_get_datum_by_name(const char *name)