remove old description text
[PyX/mjg.git] / pyx / t1strip / pyxadapt.h
blob5818aab4721b12e6d8ab4d22791a11dac897b4e6
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include <stdarg.h>
6 #define MAX_CHAR_CODE 255
7 #define PRINTF_BUF_SIZE 1024
8 #define SMALL_BUF_SIZE 256
10 #define check_buf(size, buf_size) \
11 if ((size) >= buf_size - 2) \
12 pdftex_fail("buffer overflow [%i bytes]", (int)(buf_size))
14 #define append_char_to_buf(c, p, buf, buf_size) do { \
15 if (c == 9) \
16 c = 32; \
17 if (c == 13 || c == EOF) \
18 c = 10; \
19 if (c != ' ' || (p > buf && p[-1] != 32)) { \
20 check_buf(p - buf, buf_size); \
21 *p++ = c; \
22 } \
23 } while (0)
25 #define append_eol(p, buf, buf_size) do { \
26 if (p - buf > 1 && p[-1] != 10) { \
27 check_buf(p - buf, buf_size); \
28 *p++ = 10; \
29 } \
30 if (p - buf > 2 && p[-2] == 32) { \
31 p[-2] = 10; \
32 p--; \
33 } \
34 *p = 0; \
35 } while (0)
37 #define remove_eol(p, buf) do { \
38 p = strend(buf) - 1; \
39 if (*p == 10) \
40 *p = 0; \
41 } while (0)
43 #define skip(p, c) if (*p == c) p++
44 #define strend(s) strchr(s, 0)
45 #define xtalloc(n, t) ((t *) xmalloc ((n) * sizeof (t)))
46 #define xfree(p) do { if (p != 0) free(p); p = 0; } while (0)
48 #define false 0
49 #define true 1
50 #define xstrdup strdup
51 #define xmalloc malloc
52 #define xfclose(a, b) (fclose(a))
53 #define isdigit(c) ((c) >= '0' && (c) <= '9')
54 #define search(a, b, c) (fopen(b, "rb"))
55 #define integer int
56 #define boolean char