scc.h (1383B)
1 #include <stddef.h> 2 3 extern int enadebug; 4 5 #ifndef NDEBUG 6 #define DBG(...) dbg(__VA_ARGS__) 7 #define DBGON() (enadebug = 1) 8 #else 9 #define DBG(...) 10 #define DBGON() 11 #endif 12 13 #define TINT long long 14 #define TUINT unsigned long long 15 #define TUINT_MAX ULLONG_MAX 16 #define TINT_MAX LLONG_MAX 17 #define TUINT_MIN ULLONG_MIN 18 #define TINT_MIN LLONG_MIN 19 #define TFLOAT double 20 #define SIZET size_t 21 22 struct items { 23 char **s; 24 unsigned n; 25 }; 26 27 #ifdef CLOCKS_PER_SEC 28 struct fprop { 29 unsigned uid; 30 unsigned gid; 31 unsigned long mode; 32 long size; 33 time_t time; 34 }; 35 #endif 36 37 typedef struct alloc Alloc; 38 39 extern void die(const char *fmt, ...); 40 extern void dbg(const char *fmt, ...); 41 extern void newitem(struct items *items, char *item); 42 extern void *xmalloc(size_t size); 43 extern void *xcalloc(size_t nmemb, size_t size); 44 extern char *xstrdup(const char *s); 45 extern void *xrealloc(void *buff, size_t size); 46 extern Alloc *alloc(size_t size, size_t nmemb); 47 extern void dealloc(Alloc *allocp); 48 extern void *new(Alloc *allocp); 49 extern void delete(Alloc *allocp, void *p); 50 extern int casecmp(const char *s1, const char *s2); 51 extern unsigned genhash(char *name); 52 extern char *canonical(char *); 53 54 #ifdef CLOCKS_PER_SEC 55 extern long long fromepoch(time_t); 56 extern time_t totime(long long); 57 extern int getstat(char *, struct fprop *); 58 extern int setstat(char *, struct fprop *); 59 #endif