! . */
| 1881 | |
| 1882 | /*! . */ |
| 1883 | GMT_LOCAL int gmtapi_begin_io (struct GMTAPI_CTRL *API, unsigned int direction) { |
| 1884 | /* Initializes the i/o mechanism for either input or output (depends on direction). |
| 1885 | * gmtapi_begin_io must be called before any bulk data i/o is allowed. |
| 1886 | * direction: Either GMT_IN or GMT_OUT. |
| 1887 | * Returns: false if successful, true if error. |
| 1888 | */ |
| 1889 | |
| 1890 | struct GMT_CTRL *GMT = NULL; |
| 1891 | if (API == NULL) return_error (API, GMT_NOT_A_SESSION); |
| 1892 | if (!(direction == GMT_IN || direction == GMT_OUT)) return_error (API, GMT_NOT_A_VALID_DIRECTION); |
| 1893 | API->error = GMT_NOERROR; |
| 1894 | if (!API->registered[direction]) |
| 1895 | GMT_Report (API, GMT_MSG_DEBUG, "gmtapi_begin_io: No %s resources registered\n", GMT_direction[direction]); |
| 1896 | /* Passed basic sanity checks */ |
| 1897 | GMT = API->GMT; |
| 1898 | API->io_mode[direction] = GMTAPI_BY_SET; |
| 1899 | API->io_enabled[direction] = true; /* OK to access resources */ |
| 1900 | GMT->current.io.ogr = GMT_OGR_UNKNOWN; |
| 1901 | GMT->current.io.variable_in_columns = false; |
| 1902 | GMT->current.io.need_previous = (GMT->common.g.active || GMT->current.io.skip_duplicates); |
| 1903 | GMT->current.io.segment_header[0] = GMT->current.io.curr_text[0] = 0; |
| 1904 | GMT_Report (API, GMT_MSG_DEBUG, "gmtapi_begin_io: %s resource access is now enabled [container]\n", GMT_direction[direction]); |
| 1905 | |
| 1906 | return (GMT_NOERROR); /* No error encountered */ |
| 1907 | } |
| 1908 | |
| 1909 | /* Mapping of internal [row][col] indices to a single 1-D index. |
| 1910 | * Internally, row and col both starts at 0. These will be accessed |
no test coverage detected