TP 13 exo2: Add the code structure and some basic displaying routines for the tic...
[TD_C.git] / TP_13 / exo2 / lib / macros.h
diff --git a/TP_13/exo2/lib/macros.h b/TP_13/exo2/lib/macros.h
new file mode 100644 (file)
index 0000000..3c0ad02
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * =====================================================================================
+ *
+ *       Filename:  macros.h
+ *
+ *    Description:  Some useful macros 
+ *
+ *        Version:  1.0
+ *        Created:  09/03/2017 15:28:46
+ *       Revision:  none
+ *       Compiler:  gcc
+ *
+ *         Author:  Jerome Benoit (fraggle), jerome.benoit@piment-noir.org
+ *   Organization:  Piment Noir
+ *
+ * =====================================================================================
+ */
+
+#ifndef MACROS_H
+#define MACROS_H
+
+#include <stdlib.h>
+
+/* definition to expand macro then apply to pragma message */
+#define VALUE_TO_STRING(x) #x
+#define VALUE(x) VALUE_TO_STRING(x)
+#define VAR_NAME_VALUE(var) #var "=" VALUE(var)
+
+/* FIXME: ensure we manipulate real array */
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
+
+#endif /*  MACROS_H */