Sfoglia il codice sorgente

Make minmea_isfield public.

This function is useful when writing libraries that use minmea and support NMEA
as well as other sentence types.
Steven Sloboda 7 anni fa
parent
commit
85439b97dd
2 ha cambiato i file con 9 aggiunte e 5 eliminazioni
  1. 0 5
      minmea.c
  2. 9 0
      minmea.h

+ 0 - 5
minmea.c

@@ -10,7 +10,6 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 #include <stdarg.h>
 
 #define boolstr(s) ((s) ? "true" : "false")
@@ -85,10 +84,6 @@ bool minmea_check(const char *sentence, bool strict)
     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 result = false;

+ 9 - 0
minmea.h

@@ -13,6 +13,7 @@
 extern "C" {
 #endif
 
+#include <ctype.h>
 #include <stdint.h>
 #include <stdbool.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);
 }
 
+/**
+ * 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
 }
 #endif