79 |
|
|
80 |
|
static char basis_definition[][256] = { |
81 |
|
|
82 |
+ |
"\t<DataDefinition>\n" |
83 |
|
"\t\t<IncidentDataStructure>Columns</IncidentDataStructure>\n" |
84 |
|
"\t\t<AngleBasis>\n" |
85 |
|
"\t\t\t<AngleBasisName>LBNL/Klems Full</AngleBasisName>\n" |
86 |
< |
"\t\t</AngleBasis>\n", |
86 |
> |
"\t\t\t</AngleBasis>\n" |
87 |
> |
"\t</DataDefinition>\n", |
88 |
|
|
89 |
+ |
"\t<DataDefinition>\n" |
90 |
|
"\t\t<IncidentDataStructure>Columns</IncidentDataStructure>\n" |
91 |
|
"\t\t<AngleBasis>\n" |
92 |
|
"\t\t\t<AngleBasisName>LBNL/Klems Half</AngleBasisName>\n" |
93 |
< |
"\t\t</AngleBasis>\n", |
93 |
> |
"\t\t\t</AngleBasis>\n" |
94 |
> |
"\t</DataDefinition>\n", |
95 |
|
|
96 |
+ |
"\t<DataDefinition>\n" |
97 |
|
"\t\t<IncidentDataStructure>Columns</IncidentDataStructure>\n" |
98 |
|
"\t\t<AngleBasis>\n" |
99 |
|
"\t\t\t<AngleBasisName>LBNL/Klems Quarter</AngleBasisName>\n" |
100 |
< |
"\t\t</AngleBasis>\n", |
100 |
> |
"\t\t\t</AngleBasis>\n" |
101 |
> |
"\t</DataDefinition>\n", |
102 |
|
|
103 |
< |
"\t\t<IncidentDataStructure>TensorTree3</IncidentDataStructure>\n", |
103 |
> |
"\t<DataDefinition>\n" |
104 |
> |
"\t\t<IncidentDataStructure>TensorTree3</IncidentDataStructure>\n" |
105 |
> |
"\t</DataDefinition>\n", |
106 |
|
|
107 |
< |
"\t\t<IncidentDataStructure>TensorTree4</IncidentDataStructure>\n", |
107 |
> |
"\t<DataDefinition>\n" |
108 |
> |
"\t\t<IncidentDataStructure>TensorTree4</IncidentDataStructure>\n" |
109 |
> |
"\t</DataDefinition>\n", |
110 |
|
}; |
111 |
|
|
112 |
|
/* Copy data from file descriptor to stdout and close */ |
221 |
|
for (i = 0; i < nfield_assign; i++) { |
222 |
|
const char *fnext = field_assignment[i]; |
223 |
|
for ( ; ; ) { |
224 |
+ |
int added = 0; |
225 |
|
ezxml_t fld; |
226 |
|
char sbuf[512]; |
227 |
|
int j; |
254 |
|
fprintf(stderr, |
255 |
|
"%s: warning - adding tag <%s>\n", |
256 |
|
fn, sbuf); |
257 |
+ |
ezxml_add_txt(wtl, "\t"); |
258 |
|
fld = ezxml_add_child_d(wtl, sbuf, strlen(wtl->txt)); |
259 |
+ |
++added; |
260 |
|
} |
261 |
|
if (XMLfieldID[j].has_unit) |
262 |
|
ezxml_set_attr(fld, "unit", attr_unit); |
280 |
|
} |
281 |
|
sbuf[j] = '\0'; |
282 |
|
ezxml_set_txt_d(fld, sbuf); |
283 |
+ |
if (added) |
284 |
+ |
ezxml_add_txt(wtl, "\n\t"); |
285 |
|
fnext += (*fnext == FASEP); |
286 |
|
} |
287 |
|
} |
324 |
|
sprintf(buf, "%g", i ? |
325 |
|
.5*(abase_list[n].lat[i].tmin + abase_list[n].lat[i+1].tmin) : |
326 |
|
.0); |
327 |
+ |
ezxml_add_txt(abb, "\n\t\t\t\t"); |
328 |
|
ezxml_set_txt_d(ezxml_add_child(abb,"Theta",strlen(abb->txt)), buf); |
329 |
|
sprintf(buf, "%d", abase_list[n].lat[i].nphis); |
330 |
+ |
ezxml_add_txt(abb, "\n\t\t\t\t"); |
331 |
|
ezxml_set_txt_d(ezxml_add_child(abb,"nPhis",strlen(abb->txt)), buf); |
332 |
+ |
ezxml_add_txt(abb, "\n\t\t\t\t"); |
333 |
|
tb = ezxml_add_child(abb, "ThetaBounds", strlen(abb->txt)); |
334 |
+ |
ezxml_add_txt(tb, "\n\t\t\t\t\t"); |
335 |
|
sprintf(buf, "%g", abase_list[n].lat[i].tmin); |
336 |
< |
ezxml_set_txt(ezxml_add_child(tb,"LowerTheta",strlen(tb->txt)), buf); |
336 |
> |
ezxml_set_txt_d(ezxml_add_child(tb,"LowerTheta",strlen(tb->txt)), buf); |
337 |
> |
ezxml_add_txt(tb, "\n\t\t\t\t\t"); |
338 |
|
sprintf(buf, "%g", abase_list[n].lat[i+1].tmin); |
339 |
< |
ezxml_set_txt(ezxml_add_child(tb,"UpperTheta",strlen(tb->txt)), buf); |
339 |
> |
ezxml_set_txt_d(ezxml_add_child(tb,"UpperTheta",strlen(tb->txt)), buf); |
340 |
> |
ezxml_add_txt(tb, "\n\t\t\t\t"); |
341 |
> |
ezxml_add_txt(abb, "\n\t\t\t"); |
342 |
> |
ezxml_add_txt(ab, "\n\t\t\t"); |
343 |
|
} |
344 |
|
return 1; |
345 |
|
} |
355 |
|
if (wtl == NULL) |
356 |
|
return -1; |
357 |
|
ids = ezxml_txt(ezxml_child(wtl, "IncidentDataStructure")); |
358 |
< |
if (ids == NULL) |
358 |
> |
if (!ids[0]) |
359 |
|
return -1; |
360 |
|
for (i = 0; i < ABend; i++) { |
361 |
|
ezxml_t parsed = ezxml_parse_str(basis_definition[i], |
513 |
|
} |
514 |
|
fputs(xml+ei, stdout); /* write trailer */ |
515 |
|
free(xml); /* free string */ |
516 |
+ |
fputc('\n', stdout); |
517 |
|
return (fflush(stdout) == 0); |
518 |
|
} |
519 |
|
|
594 |
|
} |
595 |
|
/* check basis */ |
596 |
|
if (angle_basis != ABdefault) { |
597 |
+ |
size_t offset = 0; |
598 |
|
ezxml_t ab, dd = ezxml_child(wtl, "DataDefinition"); |
599 |
< |
if (dd == NULL) { |
600 |
< |
dd = ezxml_add_child(wtl, "DataDefinition", strlen(wtl->txt)); |
601 |
< |
} else if (dd->child != NULL) { |
602 |
< |
fprintf(stderr, |
599 |
> |
if (dd != NULL) { |
600 |
> |
offset = dd->off; |
601 |
> |
if (dd->child != NULL) |
602 |
> |
fprintf(stderr, |
603 |
|
"%s: warning - replacing existing <DataDefinition> in '%s'\n", |
604 |
|
caller, xml_path); |
605 |
< |
do |
606 |
< |
ezxml_remove(dd->child); |
607 |
< |
while (dd->child != NULL); |
608 |
< |
} |
584 |
< |
ezxml_insert(ezxml_parse_str(basis_definition[angle_basis], |
605 |
> |
ezxml_remove(dd); |
606 |
> |
} else |
607 |
> |
offset = strlen(wtl->txt); |
608 |
> |
dd = ezxml_insert(ezxml_parse_str(basis_definition[angle_basis], |
609 |
|
strlen(basis_definition[angle_basis])), |
610 |
< |
dd, 0); |
610 |
> |
wtl, offset); |
611 |
|
if ((ab = ezxml_child(dd, "AngleBasis")) != NULL && |
612 |
|
!finish_angle_basis(ab)) |
613 |
|
goto failure; |