pane

Termbox2 based terminal UI library
git clone git://git.dimitrijedobrota.com/pane.git
Log | Files | Refs

utils.h (596B)


      1 #ifndef UTILS_H
      2 #define UTILS_H
      3 
      4 #include <stdio.h>
      5 
      6 #define MAX(a, b) ((a > b) ? a : b)
      7 #define MIN(a, b) ((a < b) ? a : b)
      8 #define CLAMP(a, x, y) ((a) = (MAX(x, MIN(a, y))))
      9 #define ACLAMP(a, x, y) (MAX(x, MIN(a, y)))
     10 #define WCLAMP(a, x) ((a + x) % x)
     11 
     12 #define UNIMPLEMENTED                                                          \
     13 	do {                                                                   \
     14 		fprintf(stderr, "%s:%d: UNIMPLEMENTED\n", __FILE__, __LINE__); \
     15 		exit(1);                                                       \
     16 	} while (0);
     17 
     18 #define UNUSED(x) (void)(x)
     19 
     20 #endif