Make minmea_isfield public.

This function is useful when writing libraries that use minmea and support NMEA
as well as other sentence types.
This commit is contained in:
Steven Sloboda 2017-11-30 15:39:35 -05:00 committed by Kosma Moczek
parent 0a0a14a42e
commit 85439b97dd
2 changed files with 9 additions and 5 deletions

View File

@ -10,7 +10,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#define boolstr(s) ((s) ? "true" : "false") #define boolstr(s) ((s) ? "true" : "false")
@ -85,10 +84,6 @@ bool minmea_check(const char *sentence, bool strict)
return true; return true;
} }
static inline bool minmea_isfield(char c) {
return isprint((unsigned char) c) && c != ',' && c != '*';
}
bool minmea_scan(const char *sentence, const char *format, ...) bool minmea_scan(const char *sentence, const char *format, ...)
{ {
bool result = false; bool result = false;

View File

@ -13,6 +13,7 @@
extern "C" { extern "C" {
#endif #endif
#include <ctype.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <time.h> #include <time.h>
@ -277,6 +278,14 @@ static inline float minmea_tocoord(const struct minmea_float *f)
return (float) degrees + (float) minutes / (60 * f->scale); return (float) degrees + (float) minutes / (60 * f->scale);
} }
/**
* Check whether a character belongs to the set of characters allowed in a
* sentence data field.
*/
static inline bool minmea_isfield(char c) {
return isprint((unsigned char) c) && c != ',' && c != '*';
}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif