New code for detecting what an ASCII column contains #8050
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
This PR adds a set of new functions dedicated to determine what type of data they are given. These will eventually replace what happens when we examine the first input record to detect things like absolute time and geographic coordinates. I have split them up so we add a bunch of local functions in
gmt_io.c
:all called directly or via the others from a library function:
void gmtlib_string_parser (struct GMT_CTRL *GMT, char *file)
At the moment it is only used as a guru test via gmtconvert -/, a hidden option. So this PR has zero effect on the god and all other tests pass since not checked by this function (yet). I added a new test (
test/gmtconvert/testparser.sh
) that reads a bunch of strings from thestrings.txt
file and tries to determine the type of data column (LON, LAT, GEO, TIME, STRONG, DIMENSION, GEODIMENSION, DURATION). It currently passes. We need to add things tostrings.txt
to see if we can break the parser. Once robust I will replace the current fickle checks with these solid checks. For now I just want to merge this into master so more people can be asked to participate in trying to break the checks.The current
strings.txt
file looks like this, with string on the left and the answer on the right after the vertical bar.