cmdtree

A trie command launcher for X11
git clone git://jb55.com/cmdtree
Log | Files | Refs | README | LICENSE

util.h (875B)


      1 
      2 /* See LICENSE file for copyright and license details. */
      3 
      4 #ifndef CMDTREE_UTIL_H
      5 #define CMDTREE_UTIL_H
      6 
      7 #define MAX(A, B)               ((A) > (B) ? (A) : (B))
      8 #define MIN(A, B)               ((A) < (B) ? (A) : (B))
      9 #define BETWEEN(X, A, B)        ((A) <= (X) && (X) <= (B))
     10 
     11 #define INTERSECT(x,y,w,h,r)  (MAX(0, MIN((x)+(w),(r).x_org+(r).width)  - MAX((x),(r).x_org)) \
     12 			       * MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org)))
     13 #define LENGTH(X)             (sizeof X / sizeof X[0])
     14 #define TEXTW(X)              (drw_fontset_getwidth(drw, (X)) + lrpad)
     15 
     16 #define UTF_INVALID 0xFFFD
     17 #define UTF_SIZ     4
     18 
     19 
     20 void die(const char *fmt, ...);
     21 void *ecalloc(size_t nmemb, size_t size);
     22 
     23 long utf8decodebyte(const char c, size_t *i);
     24 size_t utf8validate(long *u, size_t i);
     25 size_t utf8decode(const char *c, long *u, size_t clen);
     26 
     27 #endif /* CMDTREE_UTIL_H */