MCPcopy Create free account
hub / github.com/OSGeo/PROJ / process

Function process

src/apps/geod.cpp:67–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65 putchar('\n');
66}
67static void /* file processing function */
68process(FILE *fid) {
69 char line[MAXLINE + 3], *s;
70
71 for (;;) {
72 ++emess_dat.File_line;
73 if (!(s = fgets(line, MAXLINE, fid)))
74 break;
75 if (!strchr(s, '\n')) { /* overlong line */
76 int c;
77 strcat(s, "\n");
78 /* gobble up to newline */
79 while ((c = fgetc(fid)) != EOF && c != '\n')
80 ;
81 }
82 if (*s == tag) {
83 fputs(line, stdout);
84 continue;
85 }
86 phi1 = dmstor(s, &s);
87 lam1 = dmstor(s, &s);
88 if (inverse) {
89 phi2 = dmstor(s, &s);
90 lam2 = dmstor(s, &s);
91 geod_inv();
92 } else {
93 al12 = dmstor(s, &s);
94 geod_S = strtod(s, &s) * to_meter;
95 geod_pre();
96 geod_for();
97 }
98 if (!*s && (s > line))
99 --s; /* assumed we gobbled \n */
100 if (pos_azi) {
101 if (al12 < 0.)
102 al12 += M_TWOPI;
103 if (al21 < 0.)
104 al21 += M_TWOPI;
105 }
106 if (fullout) {
107 printLL(phi1, lam1);
108 TAB;
109 printLL(phi2, lam2);
110 TAB;
111 if (oform) {
112 (void)limited_fprintf_for_number(stdout, oform,
113 al12 * RAD_TO_DEG);
114 TAB;
115 (void)limited_fprintf_for_number(stdout, oform,
116 al21 * RAD_TO_DEG);
117 TAB;
118 (void)limited_fprintf_for_number(stdout, osform,
119 geod_S * fr_meter);
120 } else {
121 (void)fputs(rtodms(pline, sizeof(pline), al12, 0, 0), stdout);
122 TAB;
123 (void)fputs(rtodms(pline, sizeof(pline), al21, 0, 0), stdout);
124 TAB;

Callers 1

mainFunction · 0.70

Calls 7

dmstorFunction · 0.85
geod_invFunction · 0.85
geod_preFunction · 0.85
geod_forFunction · 0.85
printLLFunction · 0.85
rtodmsFunction · 0.85

Tested by

no test coverage detected