6 #include <stdarg.h> /* for va_list */
15 typedef struct Filename Filename;
16 typedef struct FontSpec FontSpec;
18 char *dupstr(const char *s);
19 char *dupcat(const char *s1, ...);
20 char *dupprintf(const char *fmt, ...);
21 char *dupvprintf(const char *fmt, va_list ap);
23 void base64_encode_atom(unsigned char *data, int n, char *out);
25 struct bufchain_granule;
26 typedef struct bufchain_tag {
27 struct bufchain_granule *head, *tail;
28 int buffersize; /* current amount of buffered data */
31 void bufchain_init(bufchain *ch);
32 void bufchain_clear(bufchain *ch);
33 int bufchain_size(bufchain *ch);
34 void bufchain_add(bufchain *ch, const void *data, int len);
35 void bufchain_prefix(bufchain *ch, void **data, int *len);
36 void bufchain_consume(bufchain *ch, int len);
37 void bufchain_fetch(bufchain *ch, void *data, int len);
40 * Debugging functions.
42 * Output goes to debug.log
44 * debug(()) (note the double brackets) is like printf().
46 * dmemdump() and dmemdumpl() both do memory dumps. The difference
47 * is that dmemdumpl() is more suited for when where the memory is is
48 * important (say because you'll be recording pointer values later
49 * on). dmemdump() is more concise.
53 void dprintf(char *fmt, ...);
54 void debug_memdump(void *buf, int len, int L);
55 #define debug(x) (dprintf x)
56 #define dmemdump(buf,len) debug_memdump (buf, len, 0);
57 #define dmemdumpl(buf,len) debug_memdump (buf, len, 1);
60 #define dmemdump(buf,len)
61 #define dmemdumpl(buf,len)
65 #define lenof(x) ( (sizeof((x))) / (sizeof(*(x))))
69 #define min(x,y) ( (x) < (y) ? (x) : (y) )
72 #define max(x,y) ( (x) > (y) ? (x) : (y) )