]> www.fi.muni.cz Git - evince.git/blob - backend/dvi/mdvi-lib/sysdeps.h
Update FSF address everywhere.
[evince.git] / backend / dvi / mdvi-lib / sysdeps.h
1 /*
2  * Copyright (C) 2000, Matias Atria
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 #ifndef _SYSDEP_H
19 #define _SYSDEP_H 1
20
21 /* 
22  * The purpose of this file is to define symbols that describe the
23  * system-dependent features we use. Namely, byte order, native integer
24  * types of various sizes, and safe pointer<->integer conversion.
25  */
26
27 #include "config.h"
28
29 #ifdef WORDS_BIGENDIAN
30 #define WORD_BIG_ENDIAN 1
31 #else
32 #define WORD_LITTLE_ENDIAN 1
33 #endif
34
35 typedef unsigned long   Ulong;
36 typedef unsigned int    Uint;
37 typedef unsigned short  Ushort;
38 typedef unsigned char   Uchar;
39
40 /* this one's easy */
41 typedef unsigned char   Uint8;
42 typedef char            Int8;
43
44 /* define a datatype for 32bit integers (either int or long) */
45 #if SIZEOF_LONG == 4
46 typedef unsigned long   Uint32;
47 typedef long            Int32;
48 #else   /* SIZEOF_LONG != 4 */
49 #if SIZEOF_INT == 4
50 typedef unsigned int    Uint32;
51 typedef int             Int32;
52 #else   /* SIZEOF_INT != 4 */
53 #ifdef __cplusplus
54 #include "No.appropriate.32bit.native.type.found.Fix.sysdeps.h"
55 #else
56 #error No appropriate 32bit native type found. Fix sysdeps.h
57 #endif  /* ! __cplusplus */
58 #endif  /* SIZEOF_INT != 4 */
59 #endif  /* SIZEOF_LONG != 4 */
60
61 /* now 16bit integers (one of long, int or short) */
62 #if SIZEOF_SHORT == 2
63 typedef unsigned short  Uint16;
64 typedef short           Int16;
65 #else   /* SIZEOF_SHORT != 2 */
66 #if SIZEOF_INT == 2
67 typedef unsigned int    Uint16;
68 typedef short           Int16;
69 #else   /* SIZEOF_INT != 2 */
70 #ifdef __cplusplus
71 #include "No.appropriate.16bit.native.type.found.Fix.sysdeps.h"
72 #else
73 #error No appropriate 16bit native type found. Fix sysdeps.h
74 #endif  /* ! __cplusplus */
75 #endif  /* SIZEOF_INT != 2 */
76 #endif  /* SIZEOF_SHORT != 2 */
77
78 /* 
79  * An integer type to convert to and from pointers safely. All we do here is
80  * look for an integer type with the same size as a pointer.
81  */
82 #if SIZEOF_LONG == SIZEOF_VOID_P
83 typedef unsigned long   UINT;
84 typedef long            INT;
85 #else
86 #if SIZEOF_INT == SIZEOF_VOID_P
87 typedef unsigned int    UINT;
88 typedef int             INT;
89 #else
90 #if SIZEOF_SHORT == SIZEOF_VOID_P
91 typedef unsigned short  UINT;
92 typedef short           INT;
93 #else
94 #ifdef __cplusplus
95 #include "No.native.pointer-compatible.integer.type.found.Fix.sysdeps.h"
96 #else
97 #error No native pointer-compatible integer type found. Fix sysdeps.h
98 #endif
99 #endif
100 #endif
101 #endif
102
103 /* nice, uh? */
104 typedef void    *Pointer;
105
106 /* macros to do the safe pointer <-> integer conversions */
107 #define Ptr2Int(x)      ((INT)((Pointer)(x)))
108 #define Int2Ptr(x)      ((Pointer)((INT)(x)))
109
110 #ifdef _NO_PROTO
111 #define __PROTO(x)      ()
112 #else
113 #define __PROTO(x)      x
114 #endif
115
116 #endif  /* _SYSDEP_H */