MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / gmtlib_write_tableheader

Function gmtlib_write_tableheader

src/gmt_io.c:4590–4608  ·  view source on GitHub ↗

! . */

Source from the content-addressed store, hash-verified

4588
4589/*! . */
4590void gmtlib_write_tableheader (struct GMT_CTRL *GMT, FILE *fp, char *txt) {
4591 /* Output ASCII segment header; skip if mode is binary.
4592 * We append a newline (\n) if not is present */
4593
4594 if (!GMT->current.setting.io_header[GMT_OUT]) return; /* No output headers requested */
4595 if (gmt_M_binary_header (GMT, GMT_OUT)) /* Must write a binary header */
4596 gmtlib_io_binary_header (GMT, fp, GMT_OUT);
4597 else if (!txt || !txt[0]) /* Blank header */
4598 fprintf (fp, "%c\n", GMT->current.setting.io_head_marker_out);
4599 else if (txt[0] == GMT->current.setting.io_seg_marker[GMT_OUT])
4600 fprintf (fp, "%s\n", txt);
4601 else {
4602 size_t L = strlen (txt), k = 0;
4603 fputc (GMT->current.setting.io_head_marker_out, fp); /* Make sure we have # at start */
4604 while (k < L && strchr ("#\t ", txt[k])) k++; /* Skip header record indicator and leading whitespace */
4605 if (k < L) fprintf (fp, " %s", &txt[k]);
4606 if (txt[L-1] != '\n') fputc ('\n', fp); /* Make sure we have \n at end */
4607 }
4608}
4609
4610void gmt_insert_tableheader (struct GMT_CTRL *GMT, struct GMT_DATATABLE *T, char *txt) {
4611 /* Add one more header record to the table */

Callers 7

gmtlib_write_cptFunction · 0.85
gmtapi_write_matrixFunction · 0.85
gmtapi_write_vectorFunction · 0.85
gmtapi_put_record_fpFunction · 0.85
gmtio_write_multilinesFunction · 0.85
gmtio_write_tableFunction · 0.85
gmtlib_write_newheadersFunction · 0.85

Calls 1

gmtlib_io_binary_headerFunction · 0.85

Tested by

no test coverage detected