util.h (529B)
1#include <stdlib.h> 2#include <string.h> 3#include <stdio.h> 4#include <stdarg.h> 5#include <time.h> 6 7#define _STR(s) #s 8#define STR(s) _STR(s) 9#define ARRSIZE(a) (sizeof(a)/sizeof(a[0])) 10#define LOC() __FILE__ ":" STR(__LINE__) 11#define ASSERT(expr) assert(expr, #expr " | " LOC() "\n") 12#define ASSERTV(expr, msg, ...) assert(expr, msg " | " LOC() "\n", __VA_ARGS__) 13 14enum { OK, FAIL }; 15 16int is_numstr(const char *str); 17 18char* randstr(int n); 19 20void assert(int res, const char *fmtstr, ...); 21 22char* ask(const char *fmtstr, ...); 23