-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.h
More file actions
114 lines (76 loc) · 2.32 KB
/
types.h
File metadata and controls
114 lines (76 loc) · 2.32 KB
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
/* Copyright 2013 Jorge Merlino
This file is part of Context.
Context is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Context is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Context. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TYPES_H
#define TYPES_H
#include <sys/types.h>
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef WIN32
#include <windows.h> /* BOOL */
#endif
/*
Some rules about types:
- do not use Ulong, these are not portable.
- do not use the constants, UINT_MAX, INT_MAX and INT_MIN
The following are the assumptions about the types:
- size(Uint) >= 4
- size(Sint) >= 4
- size(Ushort) = 2
- size(Sshort) = 2
No other assumptions are to be made.
*/
/*
This file contains some basic type definition.
*/
/** Unsigned char type. */
typedef unsigned char Uchar;
/** Unsigned short type */
typedef unsigned short Ushort;
/** Unsigned int type. */
typedef unsigned long Uint;
/** Signed int type. */
typedef signed long Sint;
/*
The following is the central case distinction to accomodate
code for 32 bit integers and 64 bit integers.
*/
#ifdef SIXTYFOURBITS
/** Base 2 logarithm of wordsize. */
#define LOGWORDSIZE 6
/** Unsigned integer constant. */
#define UintConst(N) (N##UL)
#else
/** Base 2 logarithm of wordsize. */
#define LOGWORDSIZE 5
/** Unsigned integer constant. */
#define UintConst(N) (N##U)
#endif
/** Type of unsigned integer in <i>printf</i>. */
typedef unsigned long Showuint;
/** Type of signed integer in <i>printf</i>. */
typedef signed long Showsint;
#ifndef BOOL
/** Boolean data type. */
#define BOOL unsigned char
#endif
#ifndef False
/** False boolean constant. */
#define False ((BOOL) 0)
#endif
#ifndef True
/** True boolean constant. */
#define True ((BOOL) 1)
#endif
#endif