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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
.TH LIBNORMALFORM_ALL 3 LIBNORMALFORM
.SH NAME
libnormalform_all \- Universal qualifier
.SH SYNOPSIS
.nf
#include <libnormalform.h>
struct libnormalform_mapping {
void *\fIkey\fP;
void *\fIvalue\fP;
};
struct libnormalform_map {
struct libnormalform_mapping *\fImappings\fP;
size_t \fInmappings\fP;
void *\fIuser_data\fP;
const char *\fIidentifier\fP;
struct libnormalform_map *\fIcopy_for_clone\fP;
};
LIBNORMALFORM_SENTENCE *
libnormalform_all(struct libnormalform_map *\fId\fP, LIBNORMALFORM_SENTENCE *\fIk\fP, LIBNORMALFORM_SENTENCE *\fIv\fP);
LIBNORMALFORM_SENTENCE *
libnormalform_universally(struct libnormalform_map *\fId\fP, LIBNORMALFORM_SENTENCE *\fIv\fP);
.fi
.PP
Link with
.IR -lnormalform .
.SH DESCRIPTION
The
.BR libnormalform_all ()
function creates a sentence that is true
when and only when the sentence
.I v
is true for the
.I .value
for every element in
.I d
for which
.I k
is also true for the
.I .key
of the element.
.PP
The
.BR libnormalform_universally ()
function creates a sentence that is true
when and only when the sentence
.I v
is true for the
.I .value
of every element in
.IR d .
.PP
.I d->mappings
and
.I d->nmappings
is used only be the
.BR libnormalform_evaluate (3)
function and must be set before
.BR libnormalform_evaluate (3)
is called, but need not be set
earlier.
.I d->nmappings
shall be set to number of elements in
the qualifers domain of interest, and
.I d->mappings
shall be set to the list of elements
in the domain. Each element shall have its
.I .key
set to the value the antecedent formula
.RI ( k )
is tested on, and
.I .value
set to the value the predicate formula
.RI ( v )
is tested on; these fields may be
.IR NULL ,
and are ultimately evaluated via
arguments passed to the
.BR libnormalform_function (3)
function but may undergo transformation
via arguments passed to the
.BR libnormalform_transformation (3)
function on the way.
.PP
The values
.I d->mappings
and
.I d->nmappings
may be set differently every time the
.BR libnormalform_evaluate (3)
is called.
.PP
See
.BR libnormalform_to_string (3)
for the purpose of
.IR d->identifier ,
it need not be set before the
.BR libnormalform_to_string (3)
function is called.
.PP
See
.BR libnormalform_clone (3)
for the purpose of
.IR d->copy_for_clone ,
it need not be set before the
.BR libnormalform_clone (3)
function is called.
.PP
The application can set
.I d->user_data
set freely, and can opt to leave it
unset. It is never used or reference
by the library, but it could be used
by the application to identify the
domain.
.PP
.I d
must not be
.IR NULL .
.PP
The returned pointer shall either be
deallocated with the
.BR libnormalform_free (3)
function or be relinquished by being
used as part of another sentence.
.PP
These functions adopt the ownership of any
.I LIBNORMALFORM_SENTENCE *
passed into it. Therefore, the user shall
not attempt to deallocate input sentences.
This holds even on failure: if the function
fails, input sentences are deallocated.
.SH RETURN VALUE
Upon successful completion, the
.BR libnormalform_all ()
and
.BR libnormalform_universally ()
functions return an object representing
the sentence; otherwise, the functions
return
.I NULL
and set
.I errno
to indicate the error.
.SH ERRORS
The
.BR libnormalform_all ()
and
.BR libnormalform_universally ()
functions fails if:
.TP
.I ENOMEM
Insufficient memory was available to
create the sentence object.
.PP
These functions will also fail without setting
.I errno
if
.I k
or
.I v
is
.IR NULL .
.SH ATTRIBUTES
For an explanation of the terms used in this
section, see
.BR attributes (7)
and
.IR "info \(dq(libc)POSIX Safety Concepts\(dq" .
.TS
allbox;
lb lb lb
l l l.
Interface Attribute Value
T{
.BR libnormalform_all (),
.br
.BR libnormalform_universally ()
T} Thread safety MT-Safe race:\fIk\fP,\fIv\fP
T{
.BR libnormalform_all (),
.br
.BR libnormalform_universally ()
T} Async-signal safety AS-Unsafe heap
T{
.BR libnormalform_all (),
.br
.BR libnormalform_universally ()
T} Async-cancel safety AC-Safe mem, AC-Unsafe heap
.TE
.SH SEE ALSO
.BR libnormalform (7),
.BR libnormalform_function (3)
|