YAP
7.1.0
YapTerm.h
1
/*************************************************************************
2
* *
3
* YAP Prolog %W% %G% *
4
* Yap Prolog was developed at NCCUP - Universidade do Porto *
5
* *
6
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
7
* *
8
**************************************************************************
9
* *
10
* File: Yap.h *
11
* mods: *
12
* comments: abstract type definitions for YAP *
13
* version: $Id: Yap.h,v 1.38 2008-06-18 10:02:27 vsc Exp $ *
14
*************************************************************************/
15
16
#ifndef YAPTTERM_H
17
18
#define YAPPTERM_H 1
19
20
#ifndef YAP_H
21
#include "YapTermConfig.h"
22
#include "config.h"
23
24
#endif
25
26
#if HAVE_STDINT_H
27
#include <stdint.h>
28
#endif
29
#if HAVE_INTTYPES_H
30
#include <inttypes.h>
31
#endif
32
33
/* truth-values */
34
/* stdbool defines the booleam type, bool,
35
and the constants false and true */
36
#if HAVE_STDBOOL_H
37
#include <stdbool.h>
38
#else
39
#ifndef true
40
typedef
int
_Bool;
41
#define bool _Bool;
42
43
#define false 0
44
#define true 1
45
#endif
46
#endif
/* HAVE_STDBOOL_H */
47
48
49
#define ALIGN_BY_TYPE(X, TYPE) \
50
(((CELL)(X) + (sizeof(TYPE) - 1)) & ~(sizeof(TYPE) - 1))
51
52
#ifndef EXTERN
53
#ifdef MSC_VER
54
#define EXTERN
55
#else
56
#define EXTERN extern
57
#endif
58
#endif
59
60
/* defines integer types Int and UInt (unsigned) with the same size as a ptr
61
** and integer types Short and UShort with half the size of a ptr */
62
63
#if defined(PRIdPTR)
64
65
typedef
intptr_t YAP_Int;
66
typedef
uintptr_t YAP_UInt;
67
68
#elif defined(_WIN64)
69
70
71
typedef
int64_t YAP_Int;
72
typedef
uint64_t YAP_UInt;
73
74
#elif defined(_WIN32)
75
76
typedef
int32_t YAP_Int;
77
typedef
uint32_t YAP_UInt;
78
79
#elif SIZEOF_LONG_INT == SIZEOF_INT_P
80
81
typedef
long
int
YAP_Int;
82
typedef
unsigned
long
int
YAP_UInt;
83
84
#elif SIZEOF_INT == SIZEOF_INT_P
85
86
typedef
int
YAP_Int;
87
typedef
unsigned
int
YAP_UInt;
88
89
#else
90
#error Yap require integer types of the same size as a pointer
91
#endif
92
93
/* */
typedef
short
int
YAP_Short;
94
/* */
typedef
unsigned
short
int
YAP_UShort;
95
96
typedef
YAP_UInt YAP_CELL;
97
typedef
YAP_UInt YAP_Term;
98
99
/* Type definitions */
100
101
102
#ifndef TRUE
103
#define TRUE true
104
#endif
105
#ifndef FALSE
106
#endif
107
108
typedef
bool
YAP_Bool;
109
#define FALSE false
110
111
typedef
YAP_Int YAP_handle_t;
112
113
114
typedef
double
YAP_Float;
115
116
typedef
void
*YAP_Atom;
117
118
typedef
void
*YAP_Functor;
119
120
#ifdef YAP_H
121
122
typedef
YAP_Int Int;
123
typedef
YAP_UInt UInt;
124
typedef
YAP_Short Short;
125
typedef
YAP_UShort UShort;
126
127
typedef
uint16_t BITS16;
128
typedef
int16_t SBITS16;
129
typedef
uint32_t BITS32;
130
131
typedef
YAP_CELL CELL;
132
133
typedef
YAP_Term Term;
134
135
#define WordSize sizeof(BITS16)
136
#define CellSize sizeof(CELL)
137
#define SmallSize sizeof(SMALLUNSGN)
138
139
typedef
YAP_Int Int;
140
typedef
YAP_Float Float;
141
typedef
YAP_handle_t yhandle_t;
142
143
#endif
144
145
#include "YapError.h"
146
147
#include "../os/encoding.h"
148
149
typedef
encoding_t YAP_encoding_t;
150
151
#include "YapFormat.h"
152
153
/*************************************************************************************************
154
type casting macros
155
*************************************************************************************************/
156
157
#if SIZEOF_INT < SIZEOF_INT_P
158
#define SHORT_INTS 1
159
#else
160
#define SHORT_INTS 0
161
#endif
162
163
#ifdef __GNUC__
164
typedef
long
long
int
YAP_LONG_LONG;
165
typedef
unsigned
long
long
int
YAP_ULONG_LONG;
166
#else
167
typedef
long
int
YAP_LONG_LONG;
168
typedef
unsigned
long
int
YAP_ULONG_LONG;
169
#endif
170
171
#define Unsigned(V) ((CELL)(V))
172
#define Signed(V) ((Int)(V))
173
174
#endif
include
YapTerm.h
Generated by
1.9.3