summaryrefslogtreecommitdiff
path: root/dviware/quicspool/standard/standtype.h
blob: 7ae0a5a44b070a8e8eb3c90bfa4da696d04f46b0 (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
/* $Header: standtype.h,v 1.1 88/01/15 13:07:17 simpson Rel $ */
/*
$Log:	standtype.h,v $
 * Revision 1.1  88/01/15  13:07:17  simpson
 * initial release
 * 
 * Revision 0.1  87/12/11  18:34:16  simpson
 * beta test
 * 
*/
/* Standard machine independent type definitions. */

#ifndef	STANDARD_TYPE	/* prevent multiple inclusions	*/
#define	STANDARD_TYPE

/*
 * Integers
 *     Tiny/UnsignedTiny	8+ bit integers
 *     Short/UnsignedShort	16+ bit integers
 *     Integer/UnsignedInteger	natural machine integer size
 *     Long/UnsignedLong	32+ bit integers
 *
 * Bits
 *     TinyBits		8+ bits
 *     Bits		16+ bits
 *     LongBits		32+ bits
 *
 * Booleans
 *     TinyBoolean
 *     Boolean
 *
 * Void
 *
 * Storage Classes
 *     Export		Seen in other compilation units
 *     Import		Supplied by another compilation unit
 *     Local		Unseen outside compilation unit
 */

/*
 * Each of the following sections for the integer types defines both
 * a base type and an extraction macro for the value.
 */

typedef char	Tiny;
/* Not all machines have signed characters so we may have to simulate them. */
#ifdef CHAR_IS_SIGNED
#   define TINY(x) (x)
#else
#   define TINY(x) (((x) & MIN_TINY) ? (~MAX_TINY | (x)) : (x))
#endif CHAR_IS_SIGNED

/* Not all compilers support unsigned chars so we may have to simulate them. */
#ifdef HAS_UNSIGNED_CHAR
    typedef unsigned char UnsignedTiny;
#else
    typedef char UnsignedTiny;
#endif HAS_UNSIGNED_CHAR
#ifdef CHAR_IS_SIGNED
#   define UNSIGNED_TINY(x) ((x) & MAX_UNSIGNED_TINY)
#else
#   define UNSIGNED_TINY(x) (x)
#endif

/*
 * All compilers have signed short integers.  This type is included
 * for lexical consistency.
 */
typedef short Short;

/* Not all compilers support unsigned shorts so we may have to simulate them. */
#ifdef HAS_UNSIGNED_SHORT
    typedef unsigned short UnsignedShort;
#else
    typedef short UnsignedShort;
#endif
#   define UNSIGNED_SHORT(x) ((unsigned)(x) & MAX_UNSIGNED_SHORT)

/* These types are solely for lexical consistency. */
typedef int Integer;
typedef	unsigned int UnsignedInteger;

typedef long Long;

/* Not all compilers support unsigned longs so we may have to simulate them. */
#ifdef HAS_UNSIGNED_LONG
    typedef unsigned long UnsignedLong;
#   define UNSIGNED_LONG(s) ((UnsignedLong)(x))
#else
    typedef long UnsignedLong;
#   define UNSIGNED_LONG(x) ((long)(x) & MAX_LONG)
#endif HAS_UNSIGNED_LONG

/* Boolean types take on only the values TRUE or FALSE. */
typedef	char TinyBoolean;
typedef	short Boolean;

/* This type is included for lexical consistency. */
typedef char Character;

/* Bit types are used only for bit set, clear and test operations. */
typedef	char TinyBits;
typedef	short Bits;
typedef	long LongBits;

/* Not all compilers support void functions so we may have to simulate it. */
#ifdef HAS_VOID
#   define Void void
#else
    typedef int Void;
#endif

/* Storage classes. */
#define	Export
#define Import extern
#define	Local static

#endif	STANDARD_TYPE