6 #include <stdio.h> /* for FILE * */
7 #include <stdarg.h> /* for va_list */
16 typedef struct Filename Filename;
17 typedef struct FontSpec FontSpec;
19 unsigned long parse_blocksize(const char *bs);
21 char *dupstr(const char *s);
22 char *dupcat(const char *s1, ...);
23 char *dupprintf(const char *fmt, ...);
24 char *dupvprintf(const char *fmt, va_list ap);
26 char *fgetline(FILE *fp);
28 void base64_encode_atom(unsigned char *data, int n, char *out);
30 struct bufchain_granule;
31 typedef struct bufchain_tag {
32 struct bufchain_granule *head, *tail;
33 int buffersize; /* current amount of buffered data */
36 void bufchain_init(bufchain *ch);
37 void bufchain_clear(bufchain *ch);
38 int bufchain_size(bufchain *ch);
39 void bufchain_add(bufchain *ch, const void *data, int len);
40 void bufchain_prefix(bufchain *ch, void **data, int *len);
41 void bufchain_consume(bufchain *ch, int len);
42 void bufchain_fetch(bufchain *ch, void *data, int len);
45 * Debugging functions.
47 * Output goes to debug.log
49 * debug(()) (note the double brackets) is like printf().
51 * dmemdump() and dmemdumpl() both do memory dumps. The difference
52 * is that dmemdumpl() is more suited for when where the memory is is
53 * important (say because you'll be recording pointer values later
54 * on). dmemdump() is more concise.
58 void debug_printf(char *fmt, ...);
59 void debug_memdump(void *buf, int len, int L);
60 #define debug(x) (debug_printf x)
61 #define dmemdump(buf,len) debug_memdump (buf, len, 0);
62 #define dmemdumpl(buf,len) debug_memdump (buf, len, 1);
65 #define dmemdump(buf,len)
66 #define dmemdumpl(buf,len)
70 #define lenof(x) ( (sizeof((x))) / (sizeof(*(x))))
74 #define min(x,y) ( (x) < (y) ? (x) : (y) )
77 #define max(x,y) ( (x) > (y) ? (x) : (y) )