YAP
7.1.0
Toggle main menu visibility
Main Page
Related Pages
Modules
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
y
~
Functions
a
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
y
~
Variables
a
c
e
f
g
i
k
m
n
o
p
q
r
s
t
v
Files
File List
File Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
y
Functions
c
e
m
y
Variables
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
y
Macros
•
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Atoms.h
1
/*************************************************************************
2
* *
3
* YAP Prolog %W% %G%
4
* *
5
* Yap Prolog was developed at NCCUP - Universidade do Porto *
6
* *
7
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
8
* *
9
**************************************************************************
10
* *
11
* File: Atoms.h.m4 *
12
* Last rev: 19/2/88 *
13
* mods: *
14
* comments: atom properties header file for YAP *
15
* *
16
*************************************************************************/
17
18
#ifndef ATOMS_H
19
#define ATOMS_H 1
20
21
#ifndef EXTERN
22
#ifndef ADTDEFS_C
23
#define EXTERN static
24
#else
25
#define EXTERN
26
#endif
27
#endif
28
29
#include <wchar.h>
30
31
typedef
struct
atom_blob
{
32
size_t
length;
33
char
data[MIN_ARRAY];
34
}
atom_blob_t
;
35
36
/********* operations for atoms ****************************************/
37
38
/* Atoms are assumed to be uniquely represented by an OFFSET and to have
39
associated with them a struct of type AtomEntry
40
The two functions
41
RepAtom : Atom -> *AtomEntry
42
AbsAtom : *AtomEntry -> Atom
43
are used to encapsulate the implementation of atoms
44
*/
45
46
typedef
struct
AtomEntryStruct
*
Atom
;
47
typedef
struct
PropEntryStruct
*
Prop
;
48
49
/* I can only define the structure after I define the actual atoms */
50
51
/* atom structure */
52
typedef
struct
AtomEntryStruct
{
53
Atom
NextOfAE;
/* used to build hash chains */
54
Prop
PropsOfAE;
/* property list for this atom */
55
#if defined(YAPOR) || defined(THREADS)
56
rwlock_t
ARWLock;
57
#endif
58
59
union
{
60
unsigned
char
uUStrOfAE[MIN_ARRAY];
/* representation of atom as a string */
61
char
uStrOfAE[MIN_ARRAY];
/* representation of atom as a string */
62
struct
atom_blob
blob[MIN_ARRAY];
63
} rep;
64
}
AtomEntry
;
65
66
// compatible with C and C++;
67
typedef
struct
ExtraAtomEntryStruct
{
68
Atom
NextOfAE;
/* used to build hash chains */
69
Prop
PropsOfAE;
/* property list for this atom */
70
#if defined(YAPOR) || defined(THREADS)
71
rwlock_t
ARWLock;
72
#endif
73
74
union
{
75
unsigned
char
uUStrOfAE[4];
/* representation of atom as a string */
76
char
uStrOfAE[4];
/* representation of atom as a string */
77
struct
atom_blob
blob[2];
78
} rep;
79
}
ExtraAtomEntry
;
80
81
#define UStrOfAE rep.uUStrOfAE
82
#define StrOfAE rep.uStrOfAE
83
84
/* Props and Atoms are stored in chains, ending with a NIL */
85
#ifdef USE_OFFSETS
86
#define EndOfPAEntr(P) (Addr(P) == AtomBase)
87
#else
88
#define EndOfPAEntr(P) (Addr(P) == NIL)
89
#endif
90
91
/* ********************** Properties **********************************/
92
93
#if defined(USE_OFFSETS)
94
#define USE_OFFSETS_IN_PROPS 1
95
#else
96
#define USE_OFFSETS_IN_PROPS 0
97
#endif
98
99
typedef
CELL PropFlags;
100
101
/* basic property entry structure */
102
typedef
struct
PropEntryStruct
{
103
Prop
NextOfPE;
/* used to chain properties */
104
PropFlags KindOfPE;
/* kind of property */
105
}
PropEntry
;
106
107
/* ************************* Functors **********************************/
108
109
/* Functor data type
110
abstype Functor = atom # int
111
with MkFunctor(a,n) = ...
112
and NameOfFunctor(f) = ...
113
and ArityOfFunctor(f) = ... */
114
115
#define MaxArity 255
116
117
typedef
size_t
arity_t;
118
119
#define FunctorProperty ((PropFlags)(0xbb00))
120
121
/* functor property */
122
typedef
struct
FunctorEntryStruct
{
123
Prop
NextOfPE;
/* used to chain properties */
124
PropFlags KindOfPE;
/* kind of property */
125
arity_t ArityOfFE;
/* arity of functor */
126
Atom
NameOfFE;
/* back pointer to owner atom */
127
Prop
PropsOfFE;
/* pointer to list of properties for this functor */
128
#if defined(YAPOR) || defined(THREADS)
129
rwlock_t
FRWLock;
130
#endif
131
}
FunctorEntry
;
132
133
typedef
FunctorEntry
*
Functor
;
134
135
#endif
/* ATOMS_H */
AtomEntryStruct
Definition:
Atoms.h:52
ExtraAtomEntryStruct
Definition:
Atoms.h:67
FunctorEntryStruct
Definition:
Atoms.h:122
PropEntryStruct
Definition:
Atoms.h:102
atom_blob
Definition:
Atoms.h:31
rwlock_t
Definition:
locks_alpha.h:38
H
Atoms.h
Generated by
1.9.3