24 #include "local_proto.h" 
   26 static int get_a_e2_rf(
const char *, 
const char *, 
double *, 
double *,
 
   49     if (proj_keys == 
NULL)
 
   75                               double *e2, 
double *rf)
 
   79     const char *str, *str3;
 
  126                                 "(rf, es or b) in file"));
 
  128             if (get_a_e2_rf(str4, str1, a, e2, rf) == 0)
 
  130                                 "(a, rf, es or b) in file"));
 
  135             if ((str == 
NULL) || (strcmp(str, 
"ll") == 0)) {
 
  161     struct ellps_list *
list, *listhead;
 
  169             estruct->
a = 
list->a;
 
  181 int get_a_e2_rf(
const char *s1, 
const char *s2, 
double *a, 
double *e2,
 
  186     if (sscanf(s1, 
"a=%lf", a) != 1)
 
  192     if (sscanf(s2, 
"e=%lf", e2) == 1) {
 
  193         f = 1.0 - sqrt(1.0 - *e2);
 
  198     if (sscanf(s2, 
"f=1/%lf", recipf) == 1) {
 
  206     if (sscanf(s2, 
"b=%lf", &
b) == 1) {
 
  228     char name[100], descr[1024], buf1[1024], buf2[1024];
 
  232     struct ellps_list *current = 
NULL, *outputlist = 
NULL;
 
  236     fd = fopen(
file, 
"r");
 
  240             _(
"Unable to open ellipsoid table file <%s>"), 
file);
 
  246     for (line = 1; 
G_getl2(buf, 
sizeof buf, fd); line++) {
 
  248         if (*buf == 0 || *buf == 
'#')
 
  251         if (sscanf(buf, 
"%s  \"%1023[^\"]\" %s %s", 
name, descr, buf1, buf2) !=
 
  254             snprintf(buf, 
sizeof(buf), 
" %d", line);
 
  256                 strcat(badlines, 
",");
 
  257             strcat(badlines, buf);
 
  261         if (get_a_e2_rf(buf1, buf2, &a, &e2, &rf) ||
 
  262             get_a_e2_rf(buf2, buf1, &a, &e2, &rf)) {
 
  264                 current = outputlist = 
G_malloc(
sizeof(
struct ellps_list));
 
  266                 current = current->next = 
G_malloc(
sizeof(
struct ellps_list));
 
  268             current->longname = 
G_store(descr);
 
  272             current->next = 
NULL;
 
  276             snprintf(buf, 
sizeof(buf), 
" %d", line);
 
  278                 strcat(badlines, 
",");
 
  279             strcat(badlines, buf);
 
  290         n_((
"Line%s of ellipsoid table file <%s> is invalid"),
 
  291            (
"Lines%s of ellipsoid table file <%s> are invalid"), 
err),
 
  311     struct ellps_list *old;
 
  313     while (elist != 
NULL) {
 
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 void void void G_fatal_error(const char *,...) __attribute__((format(printf
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.
struct Key_Value * G_create_key_value(void)
Allocate and initialize Key_Value structure.
char * G_store(const char *)
Copy string to allocated memory.
void GPJ_free_datum(struct gpj_datum *)
Free the memory used for the strings in a gpj_datum struct.
int GPJ_get_datum_by_name(const char *, struct gpj_datum *)
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_ellipsoid_by_name(const char *name, struct gpj_ellps *estruct)
Looks up ellipsoid in ellipsoid table and returns the a, e2 parameters for the ellipsoid.
int GPJ__get_ellipsoid_params(const struct Key_Value *proj_keys, double *a, double *e2, double *rf)
Get the ellipsoid parameters from proj keys structure.
struct ellps_list * read_ellipsoid_table(int fatal)
void free_ellps_list(struct ellps_list *elist)
void GPJ_free_ellps(struct gpj_ellps *estruct)
Free ellipsoid data structure.
int GPJ_get_ellipsoid_params(double *a, double *e2, double *rf)
Get the ellipsoid parameters from the database.
#define n_(strs, strp, num)
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)