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

Function gmt_check_binary_io

src/gmt_init.c:10248–10289  ·  view source on GitHub ↗

! . */

Source from the content-addressed store, hash-verified

10246
10247/*! . */
10248int gmt_check_binary_io (struct GMT_CTRL *GMT, uint64_t n_req) {
10249 int n_errors = 0;
10250
10251 /* Check the binary options that are used with most GMT programs.
10252 * GMT is the pointer to the GMT structure.
10253 * n_req is the number of required columns. If 0 then it relies on
10254 * GMT->common.b.ncol[GMT_IN] to be non-zero.
10255 * Return value is the number of errors that where found.
10256 */
10257
10258 if (!GMT->common.b.active[GMT_IN]) return (GMT_NOERROR); /* Let machinery figure out input cols for ASCII */
10259
10260 /* These are specific tests for binary input */
10261
10262 if (GMT->common.b.ncol[GMT_IN] == 0) GMT->common.b.ncol[GMT_IN] = n_req;
10263 if (GMT->common.b.ncol[GMT_IN] == 0) {
10264 GMT_Report (GMT->parent, GMT_MSG_ERROR, "Must specify number of columns in binary input data (-bi)\n");
10265 n_errors++;
10266 }
10267 else if (n_req > GMT->common.b.ncol[GMT_IN]) {
10268 GMT_Report (GMT->parent, GMT_MSG_ERROR,
10269 "Binary input data (-bi) provides %d but must have at least %d columns\n",
10270 GMT->common.b.ncol[GMT_IN], n_req);
10271 n_errors++;
10272 }
10273 if (GMT->common.b.ncol[GMT_IN] < GMT->common.i.col.n_actual_cols) {
10274 GMT_Report (GMT->parent, GMT_MSG_ERROR,
10275 "Binary input data (-bi) provides %d but column selection (-i) asks for %d columns\n",
10276 GMT->common.b.ncol[GMT_IN], GMT->common.i.col.n_actual_cols);
10277 n_errors++;
10278 }
10279 if (GMT->common.b.active[GMT_OUT] && GMT->common.b.ncol[GMT_OUT] && (GMT->common.b.ncol[GMT_OUT] < GMT->common.o.col.n_cols)) {
10280 GMT_Report (GMT->parent, GMT_MSG_ERROR,
10281 "Binary output data (-bo) provides %d but column selection (-o) asks for %d columns\n",
10282 GMT->common.b.ncol[GMT_OUT], GMT->common.o.col.n_cols);
10283 n_errors++;
10284 }
10285
10286 GMT_Report (GMT->parent, GMT_MSG_INFORMATION, "Provides %d, expects %d-column binary data\n", GMT->common.b.ncol[GMT_IN], n_req);
10287
10288 return (n_errors);
10289}
10290
10291/*! . */
10292int gmt_parse_g_option (struct GMT_CTRL *GMT, char *txt) {

Callers 15

parseFunction · 0.85
parseFunction · 0.85
parseFunction · 0.85
parseFunction · 0.85
parseFunction · 0.85
parseFunction · 0.85
parseFunction · 0.85
parseFunction · 0.85
parseFunction · 0.85
parseFunction · 0.85
parseFunction · 0.85
parseFunction · 0.85

Calls 1

GMT_ReportFunction · 0.85

Tested by 1

parseFunction · 0.68