summaryrefslogtreecommitdiff
path: root/Build/source/texk/seetexk/types.h
blob: 947a9a10cedeee4a18f6a9d7930ccfe6e7a5c83d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
 * Copyright (c) 1987, 1989 University of Maryland
 * Department of Computer Science.  All rights reserved.
 * Permission to copy for any purpose is hereby granted
 * so long as this copyright notice remains intact.
 */

/*
 * MC-TeX types and macros (system dependent).
 * Check to make sure they are correct for your system.
 */

#ifndef _MCTEX_TYPES_
#define _MCTEX_TYPES_

#if defined(WIN32) && !defined(__MINGW32__)
#include <win32lib.h>
#undef index
#endif

/*
 * Define BSD_FILE_SYSTEM if you have the BSD file system `stat'
 * structure (with the st_blksize field).  Otherwise, MakeSeekable()
 * will be slower than necessary.
 */
#undef BSD_FILE_SYSTEM

/*
 * Define this as the name of a routine that handles overlapping block
 * copies, if there is such a routine.  Usually it will be called memmove()
 * but on 4.3BSD it is called bcopy().  Note that the 4.2BSD bcopy() does
 * not handle overlap, and must not be used here.  If there is no routine,
 * or if its overlap handling is uncertain, leave BLOCK_COPY undefined.
 *
 * (The bcopy provided in lib/bcopy.c does handle overlap.)
 */
/* #define BLOCK_COPY(from, to, len) memmove(to, from, len) */
#define BLOCK_COPY(from, to, len) bcopy(from, to, len)

#ifdef KPATHSEA

#include <kpathsea/config.h>
#include <kpathsea/c-memstr.h>

#else

/*
 * Define void as int if your compiler does not support void,
 * or if there are bugs in its support (e.g., 4.1BSD).
 */
/* #define void int */

/*
 * Define the following if and only if vfprintf is in your C library.
 * If not, lib/error.c will make assumptions about the implementation
 * of stdio.  If neither works, you may have to come up with something
 * yourself.
 */
#define HAVE_VPRINTF

/*
 * If you have memcpy/memmove, but not bcopy, use the definition below.
 * If you have neither, try the bcopy provided in lib/bcopy.c.
 */
#define bcopy(from, to, len) memmove(to, from, len)

/*
 * If you have memcmp, but not bcmp, use the definition below.
 * If you have neither, try the bcmp provided in lib/bcmp.c.
 */
#define bcmp(s1, s2, len) memcmp(s1, s2, len)

#define bzero(s, len) memset(s, '\0', len)

#define index(s, c) strchr(s, c)

#endif /* KPATHSEA */

/*
 * Conflicting WIN32 declarations.
 */
#undef DT_RIGHT
#define EndPage DviEndPage

/*
 * Define the following types and macros as required by your system.
 */

typedef short i16;		/* a 16 bit integer (signed) */

typedef long i32;		/* a 32 bit integer (signed) */
typedef unsigned long ui32;	/* a 32 bit integer (unsigned) */

/* macros to sign extend quantities that are less than 32 bits long */

/* these compilers mishandle (int)(char)(constant), but a subterfuge works */
#if defined(sun) || defined(hp300)
#define Sign8(n)	((i32)(char)(int)(n))
#endif

/* these have signed characters and (int)(char)(constant) works */
#if defined(vax) || defined(mips)
#define	Sign8(n)	((i32)(char)(n))
#endif

/* this works everywhere, but may be slow */
#ifndef	Sign8
#define Sign8(n)	((n) & 0x80 ? ((n) | ~0xff) : (n))
#endif

/* this should work everywhere */
#ifndef Sign16
#define Sign16(n)	((i32)(i16)(n))
#endif

/* this works where int is 32 bits, and >> sign extents and is fast */
#if defined(vax) || defined(mips)
#define	Sign24(n)	(((n) << 8) >> 8)
#endif

/* this works everywhere, but may be slow */
#ifndef	Sign24
#define	Sign24(n)	((n) & 0x800000 ? ((n) | ~0xffffff) : (n))
#endif

/* macros to truncate quantites that may be signed */
#define UnSign8(n)	((i32)(n) & 0xff)
#define UnSign16(n)	((i32)(n) & 0xffff)
#define UnSign24(n)	((i32)(n) & 0xffffff)

#endif /* _MCTEX_TYPES_ */