Jan Breuer
2013-03-22 4d39507183e0ace2d73f04817a398e858b66b677
libscpi/src/utils.h
@@ -38,6 +38,7 @@
#define   SCPI_UTILS_H
#include <stdint.h>
#include "scpi/config.h"
#include "scpi/types.h"
#ifdef   __cplusplus
@@ -52,12 +53,19 @@
    size_t doubleToStr(double val, char * str, size_t len) LOCAL;
    size_t strToLong(const char * str, int32_t * val) LOCAL;
    size_t strToDouble(const char * str, double * val) LOCAL;
    bool_t locateText(const char * str1, size_t len1, char ** str2, size_t * len2) LOCAL;
    bool_t locateStr(const char * str1, size_t len1, char ** str2, size_t * len2) LOCAL;
    bool_t locateText(const char * str1, size_t len1, const char ** str2, size_t * len2) LOCAL;
    bool_t locateStr(const char * str1, size_t len1, const char ** str2, size_t * len2) LOCAL;
    size_t skipWhitespace(const char * cmd, size_t len) LOCAL;
    bool_t matchPattern(const char * pattern, size_t pattern_len, const char * str, size_t str_len) LOCAL;
#if !HAVE_STRNLEN
    size_t BSD_strnlen(const char *s, size_t maxlen);
#endif
#define min(a, b)  (((a) < (b)) ? (a) : (b))
#define max(a, b)  (((a) > (b)) ? (a) : (b))
#if 0
#define max(a,b) \
   ({ __typeof__ (a) _a = (a); \
       __typeof__ (b) _b = (b); \
@@ -68,6 +76,8 @@
       __typeof__ (b) _b = (b); \
     _a < _b ? _a : _b; })
#endif
#ifdef   __cplusplus
}
#endif