*
* @file base.h
*
- * @copyright Copyright (C) 2013 Czech Technical University in Prague
+ * @copyright Copyright (C) 2013, 2015 Czech Technical University in Prague
*
* @author Carlos Jenkins <carlos@jenkins.co.cr>
*/
#ifndef __BASE_H
#define __BASE_H
-#include "os/os.h"
+// Base includes
#include "types.h"
#include "binary.h"
+#include "os/os.h"
+#include <assert.h>
+
+// General IO directives
+/**
+ * Maximum length of system buffers.
+ */
+#define MAX_BUFFER_LEN 1024
+
+
+// Debug directives
+/**
+ * Macro to mark unused variables.
+ */
+#define UNUSED(x) (void)(x)
+
+/**
+ * General debug directive.
+ */
+//#define DEBUG // - defined in preprocessor's Predefined symbols
+
+#ifdef DEBUG
+/**
+ * Macro to mark debug statements.
+ */
+# define D(x) x
+#else
+# define D(x)
+#endif
+
+/** Calculates the number of elements in an array */
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*(x)))
+
+#if defined(static_assert)
+/** Static assertion as available in C11 standard */
+#define STATIC_ASSERT(COND,MSG) static_assert(COND, #MSG)
+#else
+/** Static assertion - non-C11 fall-back */
+#define STATIC_ASSERT(COND,MSG) typedef char static_assertion_##MSG[(COND) ? 1 : -1]
+#endif
#endif /* __BASE_H */