src/utils.h

Wed, 02 Mar 2011 07:16:32 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Wed, 02 Mar 2011 07:16:32 +0000
changeset 97
240e195e4bed
parent 89
22198d0a7bef
child 98
d1af20db5f02
permissions
-rw-r--r--

Add 60Hz timer tick patch from Andrew Warkentin <andreww591 gmail com>

... I have also attached a patch that adds the 60Hz timer interrupt (I'm not sure if it's totally correct, though, since the cursor blinks rather slowly).

Received-From: Andrew Warkentin <andreww591 gmail com>
Signed-Off-By: Philip Pemberton <philpem@philpem.me.uk>

     1 #ifndef _UTILS_H
     2 #define _UTILS_H
     4 #include <stdio.h>
     6 #ifndef NDEBUG
     7 /// Log a message to stderr
     8 #  define LOG(x, ...) do { fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); } while (0)
     9 /// Log a message to stderr if 'cond' is true
    10 #  define LOG_IF(cond, x, ...) do { if (cond) fprintf(stderr, "%s:%d:%s(): " x "\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__); } while (0)
    11 #else
    12 #define LOG(x, ...)
    13 #define LOG_IF(cond, x, ...)
    14 #endif
    16 /// Get the number of elements in an array
    17 #define NELEMS(x) (sizeof(x)/sizeof(x[0]))
    19 #endif // _H_UTILS