calling render callbacks from render.c
[taskasaur.git] / headers / utils.h
1
2 #ifndef __UTILS_H__
3 #define __UTILS_H__
4
5 #define \
6 array_length(type, array)               \
7 ({                                      \
8     type* m_arr;                        \
9     int m_len;                          \
10                                         \
11     m_arr = (type*)array;               \
12     m_len = 0;                          \
13                                         \
14     while (m_arr[m_len] != 0) {         \
15         m_len += 1;                     \
16     }                                   \
17                                         \
18     m_len;                              \
19 })
20
21 extern int min(int a, int b);
22 extern int clamp(int v, int min, int max);
23 extern int floorzero(int v);
24
25 extern char* wrap_text(char* str, int max_width, int* lines);
26
27 /* array stuff */
28 extern int ar_swap_item(void** arr, int src_index, int dest_index);
29
30 #endif