Context algorithm
Semi-predictive context algorithm implementation
 All Data Structures Files Functions Variables Typedefs Macros Pages
types.h
Go to the documentation of this file.
1 /* Copyright 2013 Jorge Merlino
2 
3  This file is part of Context.
4 
5  Context is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Context is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with Context. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef TYPES_H
20 #define TYPES_H
21 
22 #include <sys/types.h>
23 #include <limits.h>
24 #include <stdlib.h>
25 #include <stdio.h>
26 
27 #ifdef WIN32
28 #include <windows.h> /* BOOL */
29 #endif
30 
31 /*
32  Some rules about types:
33  - do not use Ulong, these are not portable.
34  - do not use the constants, UINT_MAX, INT_MAX and INT_MIN
35  The following are the assumptions about the types:
36  - size(Uint) >= 4
37  - size(Sint) >= 4
38  - size(Ushort) = 2
39  - size(Sshort) = 2
40  No other assumptions are to be made.
41 */
42 
43 /*
44  This file contains some basic type definition.
45 */
46 
48 typedef unsigned char Uchar;
49 
51 typedef unsigned short Ushort;
52 
54 typedef unsigned long Uint;
55 
57 typedef signed long Sint;
58 
59 /*
60  The following is the central case distinction to accomodate
61  code for 32 bit integers and 64 bit integers.
62 */
63 
64 #ifdef SIXTYFOURBITS
65 
67 #define LOGWORDSIZE 6
68 
70 #define UintConst(N) (N##UL)
71 
72 #else
73 
75 #define LOGWORDSIZE 5
76 
78 #define UintConst(N) (N##U)
79 
80 #endif
81 
82 
84 typedef unsigned long Showuint;
85 
87 typedef signed long Showsint;
88 
89 #ifndef BOOL
90 
92 #define BOOL unsigned char
93 
94 #endif
95 
96 
97 #ifndef False
98 
100 #define False ((BOOL) 0)
101 
102 #endif
103 
104 
105 #ifndef True
106 
108 #define True ((BOOL) 1)
109 
110 #endif
111 
112 
113 #endif
114 
unsigned long Showuint
Type of unsigned integer in printf.
Definition: types.h:84
unsigned char Uchar
Unsigned char type.
Definition: types.h:48
unsigned long Uint
Unsigned int type.
Definition: types.h:54
signed long Showsint
Type of signed integer in printf.
Definition: types.h:87
signed long Sint
Signed int type.
Definition: types.h:57
unsigned short Ushort
Unsigned short type.
Definition: types.h:51