]> sigrok.org Git - libsigrok.git/blobdiff - sigrok-internal.h
Replace g_malloc{0,} with g_try_malloc{0,}.
[libsigrok.git] / sigrok-internal.h
index 85004aa13f14b8c0d27586bd6efd654825a2495b..d385340357c551d6323105443d49970fd975beee 100644 (file)
 #ifndef SIGROK_SIGROK_INTERNAL_H
 #define SIGROK_SIGROK_INTERNAL_H
 
+#include <stdarg.h>
+
+/*--- Macros ----------------------------------------------------------------*/
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+#endif
+
+#ifndef ARRAY_AND_SIZE
+#define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
+#endif
+
+/* Size of a datastore chunk in units */
+#define DATASTORE_CHUNKSIZE 512000
+
 /*--- hwplugin.c ------------------------------------------------------------*/
 
 int load_hwplugins(void);
 
+/*--- log.c -----------------------------------------------------------------*/
+
+/* Log levels for sr_log() and friends. */
+#define SR_LOG_NONE    0
+#define SR_LOG_DBG     1
+#define SR_LOG_INFO    2
+#define SR_LOG_WARN    3
+#define SR_LOG_ERR     4
+
+int sr_log(int loglevel, const char *format, ...);
+int sr_dbg(const char *format, ...);
+int sr_info(const char *format, ...);
+int sr_warn(const char *format, ...);
+int sr_err(const char *format, ...);
+
 /*--- hardware/common/serial.c ----------------------------------------------*/
 
 GSList *list_serial_ports(void);