25 #include "local_proto.h" 
   40     struct datum_list *
list, *listhead;
 
  180         G_debug(3, 
"GPJ__get_datum_params: datumname: <%s>",
 
  189         G_debug(3, 
"GPJ__get_datum_params: datumparams: <%s>",
 
  248     if (dstruct.
dx < 99999 && dstruct.
dy < 99999 && dstruct.
dz < 99999) {
 
  253             current = outputlist =
 
  256             current = current->
next =
 
  259                    dstruct.
dy, dstruct.
dz);
 
  262                    "Default 3-Parameter Transformation (May not be optimum for " 
  263                    "older datums; use this only if no more appropriate options " 
  275     fd = fopen(
file, 
"r");
 
  281     for (line = 1; 
G_getl2(buf, 
sizeof(buf), fd); line++) {
 
  282         char name[100], params[1024], where_used[1024], comment[1024];
 
  285         if (*buf == 
'\0' || *buf == 
'#')
 
  288         if (sscanf(buf, 
"%99s \"%1023[^\"]\" \"%1023[^\"]\" \"%1023[^\"]\"",
 
  289                    name, params, where_used, comment) != 4) {
 
  290             G_warning(
_(
"Error in datum table file <%s>, line %d"), 
file, line);
 
  298                 current = outputlist =
 
  301                 current = current->
next =
 
  348     struct datum_list *current = 
NULL, *outputlist = 
NULL;
 
  352     fd = fopen(
file, 
"r");
 
  358     for (line = 1; 
G_getl2(buf, 
sizeof(buf), fd); line++) {
 
  359         char name[100], descr[1024], ellps[100];
 
  363         if (*buf == 
'\0' || *buf == 
'#')
 
  366         if (sscanf(buf, 
"%s \"%1023[^\"]\" %s dx=%lf dy=%lf dz=%lf", 
name,
 
  367                    descr, ellps, &dx, &dy, &dz) != 6) {
 
  368             G_warning(
_(
"Error in datum table file <%s>, line %d"), 
file, line);
 
  373             current = outputlist = 
G_malloc(
sizeof(
struct datum_list));
 
  375             current = current->next = 
G_malloc(
sizeof(
struct datum_list));
 
  377         current->longname = 
G_store(descr);
 
  378         current->ellps = 
G_store(ellps);
 
  382         current->next = 
NULL;
 
  412     struct datum_list *old;
 
  414     while (dstruct != 
NULL) {
 
  416         G_free(dstruct->longname);
 
int G_getl2(char *, int, FILE *)
Gets a line of text from a file of any pedigree.
void G_free(void *)
Free allocated memory.
struct Key_Value * G_get_projinfo(void)
Gets projection information for location.
void G_warning(const char *,...) __attribute__((format(printf
const char * G_find_key_value(const char *, const struct Key_Value *)
Find given key (case sensitive)
void G_free_key_value(struct Key_Value *)
Free allocated Key_Value structure.
void G_strip(char *)
Removes all leading and trailing white space from string.
int G_asprintf(char **, const char *,...) __attribute__((format(printf
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
const char * G_gisbase(void)
Get full path name of the top level module directory.
int G_debug(int, const char *,...) __attribute__((format(printf
char * G_store(const char *)
Copy string to allocated memory.
#define DATUMTRANSFORMTABLE
int GPJ_get_default_datum_params_by_name(const char *name, char **params)
"Last resort" function to retrieve a "default" set of datum parameters for a datum (N....
void GPJ_free_datum_transform(struct gpj_datum_transform_list *item)
Free the memory used by a gpj_datum_transform_list struct.
void GPJ_free_datum(struct gpj_datum *dstruct)
Free the memory used for the strings in a gpj_datum struct.
struct gpj_datum_transform_list * GPJ_get_datum_transform_by_name(const char *inputname)
Internal function to find all possible sets of transformation parameters for a particular datum.
void free_datum_list(struct datum_list *dstruct)
Free the memory used by a datum_list linked list structure.
int GPJ__get_datum_params(const struct Key_Value *projinfo, char **datumname, char **params)
Extract the datum transformation-related parameters from a set of general PROJ_INFO parameters.
int GPJ_get_datum_by_name(const char *name, struct gpj_datum *dstruct)
Look up a string in datum.table file to see if it is a valid datum name and if so place its informati...
int GPJ_get_datum_params(char **name, char **params)
Extract the datum transformation-related parameters for the current location.
struct datum_list * read_datum_table(void)
Read the current GRASS datum.table from disk and store in memory.