aboutsummaryrefslogtreecommitdiffstats
path: root/man3/libnormalform_function.3
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-07-19 01:29:42 +0200
committerMattias Andrée <maandree@kth.se>2024-07-19 01:29:42 +0200
commit4294ec0ed06ee34920c9edaeebaeb8b65c720791 (patch)
treee0cded59452597c04fb38f403745a384675cb5f9 /man3/libnormalform_function.3
downloadlibnormalform-4294ec0ed06ee34920c9edaeebaeb8b65c720791.tar.gz
libnormalform-4294ec0ed06ee34920c9edaeebaeb8b65c720791.tar.bz2
libnormalform-4294ec0ed06ee34920c9edaeebaeb8b65c720791.tar.xz
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'man3/libnormalform_function.3')
-rw-r--r--man3/libnormalform_function.3152
1 files changed, 152 insertions, 0 deletions
diff --git a/man3/libnormalform_function.3 b/man3/libnormalform_function.3
new file mode 100644
index 0000000..d89c0e9
--- /dev/null
+++ b/man3/libnormalform_function.3
@@ -0,0 +1,152 @@
+.TH LIBNORMALFORM_FUNCTION 3 LIBNORMALFORM
+.SH NAME
+libnormalform_function \- Function with boolean codomain
+
+.SH SYNOPSIS
+.nf
+#include <libnormalform.h>
+
+struct libnormalform_function {
+ int (*\fIevaluate\fP)(void *user_data, void *input);
+ void *\fIuser_data\fP;
+ const char *\fIidentifier\fP;
+ struct libnormalform_function *\fIcopy_for_clone\fP;
+ struct libnormalform_function *\fIrelaxation\fP;
+ int \fIrequires_relaxation\fP;
+};
+
+LIBNORMALFORM_SENTENCE *libnormalform_function(struct libnormalform_function *\fIfunction\fP);
+.fi
+.PP
+Link with
+.IR -lnormalform .
+
+.SH DESCRIPTION
+The
+.BR libnormalform_function ()
+function creates a sentence object out
+of an application-managed function with
+a boolean output.
+.PP
+.I function->evaluate
+is used only be the
+.BR libnormalform_evaluate (3)
+function to determine the
+sentence's value for that specific
+call to the
+.BR libnormalform_evaluate (3)
+function.
+.I function->user_data is passed to
+.I *function->evaluate
+as its first argument, and the function
+input is passed as its second argument.
+The function is expected to return
+.I 1
+if the function is true for the input,
+.I 0
+if the function is false for the input,
+and
+.I -1
+on failure; on failure the function may
+optionally set
+.IR errno .
+.I function->user_data
+is only used by the application for
+application-defined purposes.
+.I function->user_data
+may, unlike
+.IR function->evalute ,
+be
+.IR NULL ;
+however
+.I function->evalute
+and
+.I function->user_data
+need not be set before the
+.BR libnormalform_evaluate (3)
+function is called.
+.PP
+See
+.BR libnormalform_to_string (3)
+for the purpose of
+.IR function->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 function->copy_for_clone ,
+it need not be set before the
+.BR libnormalform_clone (3)
+function is called.
+.PP
+See
+.BR libnormalform_express (3)
+for the purpose of
+.I function->relaxation
+and
+.IR function->requires_relaxation ,
+they need not be set before any of the
+.BR libnormalform_express (3),
+.BR libnormalform_dnf (3),
+and
+.BR libnormalform_cnf (3)
+functions are called.
+.PP
+.I function
+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.
+
+.SH RETURN VALUE
+Upon successful completion, the
+.BR libnormalform_function ()
+function returns an sentence object of
+the function; otherwise, the function
+returns
+.I NULL
+and sets
+.I errno
+to indicate the error.
+
+.SH ERRORS
+The
+.BR libnormalform_function ()
+function fails if:
+.TP
+.I ENOMEM
+Insufficient memory was available to
+create the sentence object.
+
+.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_function ()
+T} Thread safety MT-Safe
+T{
+.BR libnormalform_function ()
+T} Async-signal safety AS-Unsafe heap
+T{
+.BR libnormalform_function ()
+T} Async-cancel safety AC-Safe mem, AC-Unsafe heap
+.TE
+
+.SH SEE ALSO
+.BR libnormalform (7),
+.BR libnormalform_variable (3)