aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libj2_j2i_max_j2i.32
-rw-r--r--libj2_j2i_min_j2i.32
l---------libj2_j2i_to_j2u.31
-rw-r--r--libj2_j2i_to_j2u.c1
-rw-r--r--libj2_j2i_to_str.c5
-rw-r--r--libj2_j2u_to_j2i.c5
l---------libj2_j2u_to_str.31
-rw-r--r--libj2_j2u_to_str.c2
l---------libj2_ji_to_j2i.31
-rw-r--r--libj2_ji_to_j2i.c1
-rw-r--r--libj2_ju_to_j2i.354
-rw-r--r--libj2_ju_to_j2i.c1
l---------libj2_ju_to_j2u.31
-rw-r--r--libj2_ju_to_j2u.c1
-rw-r--r--libj2_max_j2i.3144
-rw-r--r--libj2_max_j2i.c14
-rw-r--r--libj2_min_j2i.3144
-rw-r--r--libj2_min_j2i.c14
-rw-r--r--libj2_str_to_j2i.c7
l---------libj2_str_to_j2u.31
-rw-r--r--libj2_str_to_j2u.c2
l---------libj2_str_to_j2u_sign.31
-rw-r--r--libj2_str_to_j2u_sign.c2
23 files changed, 364 insertions, 43 deletions
diff --git a/libj2_j2i_max_j2i.3 b/libj2_j2i_max_j2i.3
index e918f78..9d8e672 100644
--- a/libj2_j2i_max_j2i.3
+++ b/libj2_j2i_max_j2i.3
@@ -21,7 +21,7 @@ Link with
.SH DESCRIPTION
The above listed functions
-calculate selects the maximum value of
+selects the maximum value of
.I a
and
.I b
diff --git a/libj2_j2i_min_j2i.3 b/libj2_j2i_min_j2i.3
index c677943..3ccd8e0 100644
--- a/libj2_j2i_min_j2i.3
+++ b/libj2_j2i_min_j2i.3
@@ -21,7 +21,7 @@ Link with
.SH DESCRIPTION
The above listed functions
-calculate selects the minimum value of
+selects the minimum value of
.I a
and
.I b
diff --git a/libj2_j2i_to_j2u.3 b/libj2_j2i_to_j2u.3
new file mode 120000
index 0000000..73c5eb4
--- /dev/null
+++ b/libj2_j2i_to_j2u.3
@@ -0,0 +1 @@
+libj2_j2u_to_j2i.3 \ No newline at end of file
diff --git a/libj2_j2i_to_j2u.c b/libj2_j2i_to_j2u.c
index b3d42d1..4419c7a 100644
--- a/libj2_j2i_to_j2u.c
+++ b/libj2_j2i_to_j2u.c
@@ -3,7 +3,6 @@
#ifndef TEST
extern inline void libj2_j2i_to_j2u(const struct libj2_j2i *a, struct libj2_j2u *res);
-/* TODO Add man page */
#else
diff --git a/libj2_j2i_to_str.c b/libj2_j2i_to_str.c
index 632da78..b938f17 100644
--- a/libj2_j2i_to_str.c
+++ b/libj2_j2i_to_str.c
@@ -2,8 +2,11 @@
#include "common.h"
#ifndef TEST
-/* TODO Add man page */
extern inline size_t libj2_j2i_to_str(const struct libj2_j2i *a, char *buf, size_t bufsize, const char *digits);
+/* TODO Add man pages
+ * libj2_j2i_to_str
+ * libj2_j2u_to_str
+ */
#else
diff --git a/libj2_j2u_to_j2i.c b/libj2_j2u_to_j2i.c
index 041c79c..eb5b404 100644
--- a/libj2_j2u_to_j2i.c
+++ b/libj2_j2u_to_j2i.c
@@ -3,7 +3,10 @@
#ifndef TEST
extern inline void libj2_j2u_to_j2i(const struct libj2_j2u *a, struct libj2_j2i *res);
-/* TODO Add man page */
+/* TODO Add man pages
+ * libj2_j2u_to_j2i
+ * libj2_j2i_to_j2u
+ */
#else
diff --git a/libj2_j2u_to_str.3 b/libj2_j2u_to_str.3
new file mode 120000
index 0000000..faa4b37
--- /dev/null
+++ b/libj2_j2u_to_str.3
@@ -0,0 +1 @@
+libj2_j2i_to_str.3 \ No newline at end of file
diff --git a/libj2_j2u_to_str.c b/libj2_j2u_to_str.c
index 4fca370..a95150c 100644
--- a/libj2_j2u_to_str.c
+++ b/libj2_j2u_to_str.c
@@ -3,8 +3,6 @@
#include <errno.h>
#ifndef TEST
-/* TODO Add man page */
-
static size_t
to_power_of_two(const struct libj2_j2u *a, char *buf, size_t bufsize, const char *digits, unsigned radix)
diff --git a/libj2_ji_to_j2i.3 b/libj2_ji_to_j2i.3
new file mode 120000
index 0000000..c83c63f
--- /dev/null
+++ b/libj2_ji_to_j2i.3
@@ -0,0 +1 @@
+libj2_ju_to_j2i.3 \ No newline at end of file
diff --git a/libj2_ji_to_j2i.c b/libj2_ji_to_j2i.c
index 25618ca..1f21697 100644
--- a/libj2_ji_to_j2i.c
+++ b/libj2_ji_to_j2i.c
@@ -3,7 +3,6 @@
#ifndef TEST
extern inline void libj2_ji_to_j2i(intmax_t a, struct libj2_j2i *res);
-/* TODO Add man page */
#else
diff --git a/libj2_ju_to_j2i.3 b/libj2_ju_to_j2i.3
new file mode 100644
index 0000000..7f16ba3
--- /dev/null
+++ b/libj2_ju_to_j2i.3
@@ -0,0 +1,54 @@
+.TH LIBJ2_JU_TO_J2I 3 LIBJ2
+.SH NAME
+libj2_ju_to_j2i \- Extend integer to double-max precision
+
+.SH SYNOPSIS
+.nf
+#include <libj2.h>
+
+void \fBlibj2_ju_to_j2i\fP(uintmax_t \fIa\fP, struct libj2_j2i *\fIr\fP);
+void \fBlibj2_ju_to_j2u\fP(uintmax_t \fIa\fP, struct libj2_j2u *\fIr\fP);
+void \fBlibj2_ji_to_j2i\fP(intmax_t \fIa\fP, struct libj2_j2i *\fIr\fP);
+.fi
+.PP
+Link with
+.IR -lj2 .
+
+.SH DESCRIPTION
+The above listed functions calculate
+stores the value of
+.I a
+in
+.IR r ,
+extending
+.I a
+to double-max precision.
+.PP
+The arguments are assumed to be
+.RI non- NULL .
+
+.SH RETURN VALUE
+None.
+
+.SH ERRORS
+The above listed functions cannot fail.
+
+.SH HISTORY
+The
+.BR libj2_ju_to_j2u ()
+function was added in version 1.0 of
+.BR libj2 .
+
+The
+.BR libj2_ju_to_j2i ()
+and
+.BR libj2_ji_to_j2i ()
+functions were added in version 1.1 of
+.BR libj2 .
+
+.SH SEE ALSO
+.BR libj2 (7),
+.BR struct_libj2_j2i (3),
+.BR libj2_j2u_to_j2i (3),
+.BR libj2_j2i_to_str (3),
+.BR libj2_str_to_j2i (3)
diff --git a/libj2_ju_to_j2i.c b/libj2_ju_to_j2i.c
index fd828d8..d312047 100644
--- a/libj2_ju_to_j2i.c
+++ b/libj2_ju_to_j2i.c
@@ -3,7 +3,6 @@
#ifndef TEST
extern inline void libj2_ju_to_j2i(uintmax_t a, struct libj2_j2i *res);
-/* TODO Add man page */
#else
diff --git a/libj2_ju_to_j2u.3 b/libj2_ju_to_j2u.3
new file mode 120000
index 0000000..c83c63f
--- /dev/null
+++ b/libj2_ju_to_j2u.3
@@ -0,0 +1 @@
+libj2_ju_to_j2i.3 \ No newline at end of file
diff --git a/libj2_ju_to_j2u.c b/libj2_ju_to_j2u.c
index 914850c..2984227 100644
--- a/libj2_ju_to_j2u.c
+++ b/libj2_ju_to_j2u.c
@@ -3,7 +3,6 @@
#ifndef TEST
extern inline void libj2_ju_to_j2u(uintmax_t a, struct libj2_j2u *res);
-/* TODO Add man page */
#else
diff --git a/libj2_max_j2i.3 b/libj2_max_j2i.3
new file mode 100644
index 0000000..173c1ec
--- /dev/null
+++ b/libj2_max_j2i.3
@@ -0,0 +1,144 @@
+.TH LIBJ2_MAX_J2I 3 LIBJ2
+.SH NAME
+libj2_max_j2i \- Select maximum of a set of values
+
+.SH SYNOPSIS
+.nf
+#include <libj2.h>
+
+void \fBlibj2_max_j2i\fP(struct libj2_j2i *\fIa\fP, ... /*, NULL */)
+void \fBlibj2_max_j2i_to_j2i\fP(const struct libj2_j2i *\fIa\fP, ... /*, NULL, struct libj2_j2i *\fIr\fP */)
+const struct libj2_j2i *\fBlibj2_max_j2i_return\fP(const struct libj2_j2i *\fIa\fP, ... /*, NULL */)
+void \fBlibj2_vmax_j2i\fP(struct libj2_j2i *\fIa\fP, va_list \fIargs\fP)
+void \fBlibj2_vmax_j2i_to_j2i\fP(const struct libj2_j2i *\fIa\fP, va_list \fIargs\fP)
+const struct libj2_j2i *\fBlibj2_vmax_j2i_return\fP(const struct libj2_j2i *\fIa\fP, va_list \fIargs\fP)
+void \fBlibj2_max_j2u\fP(struct libj2_j2u *\fIa\fP, ... /*, NULL */)
+void \fBlibj2_max_j2u_to_j2u\fP(const struct libj2_j2u *\fIa\fP, ... /*, NULL, struct libj2_j2u *\fIr\fP */)
+const struct libj2_j2u *\fBlibj2_max_j2u_return\fP(const struct libj2_j2u *\fIa\fP, ... /*, NULL */)
+void \fBlibj2_vmax_j2u\fP(struct libj2_j2u *\fIa\fP, va_list \fIargs\fP)
+void \fBlibj2_vmax_j2u_to_j2u\fP(const struct libj2_j2u *\fIa\fP, va_list \fIargs\fP)
+const struct libj2_j2u *\fBlibj2_vmax_j2u_return\fP(const struct libj2_j2u *\fIa\fP, va_list \fIargs\fP)
+.fi
+.PP
+Link with
+.IR -lj2 .
+
+.SH DESCRIPTION
+The above listed functions
+selects the maximum value of
+.I a
+and all follow arguments up to the first
+(and only)
+.I NULL
+argument (the so called
+.I NULL
+sentinel). For the functions with a
+.B va_list
+parameter, arguments are read from it.
+.PP
+The arguments after
+.I a
+or, for the functions with a
+.B va_list
+parameter, inside
+.I args
+must have the same type as
+.IR a ,
+except it can be
+.B const
+regardless of whether
+.I a
+is
+.BR const .
+.PP
+For the
+.BR libj2_max_j2i (),
+.BR libj2_vmax_j2i (),
+.BR libj2_max_j2u (),
+and
+.BR libj2_vmax_j2u ()
+functions, the maximum value is stored in
+.IR a .
+.PP
+For the
+.BR libj2_max_j2i_to_j2i (),
+.BR libj2_vmax_j2i_to_j2i (),
+.BR libj2_max_j2u_to_j2u (),
+and
+.BR libj2_vmax_j2u_to_j2u ()
+functions, the maximum value is stored in
+and argument, with the same type as
+.IR a ,
+except without the qualifier
+.BR const ,
+provided by the caller immediately after the
+.I NULL
+sentinel.
+.PP
+For the
+.BR libj2_max_j2i_return (),
+.BR libj2_vmax_j2i_return (),
+.BR libj2_max_j2u_return (),
+and
+.BR libj2_vmax_j2u_return ()
+functions, the argument with the maximum
+value is returned by the function. In the
+case that multiple arguments have the same
+value which is also the maximum value, one
+of the is returned arbitrarily. It is safe
+to remove the qualifier
+.BR const
+if you know that the argument with the
+maximum value did not have the qualifier
+.BR const
+const (it is the same pointer).
+.PP
+The arguments, except the sentinel in
+the varidic lists, are assumed to be
+.RI non- NULL .
+.RI ( a
+is assumed to be
+.RI non- NULL .)
+
+.SH RETURN VALUE
+For the
+.BR libj2_max_j2i_return (),
+.BR libj2_vmax_j2i_return (),
+.BR libj2_max_j2u_return (),
+and
+.BR libj2_vmax_j2u_return ()
+functions one of the arguments with the
+highest value, is returned, for the
+other functions, there is no return value.
+
+.SH ERRORS
+The above listed functions cannot fail.
+
+.SH HISTORY
+The
+.BR libj2_max_j2u (),
+.BR libj2_max_j2u_to_j2u (),
+.BR libj2_max_j2u_return (),
+.BR libj2_vmax_j2u (),
+.BR libj2_vmax_j2u_to_j2u (),
+and
+.BR libj2_vmax_j2u_return ()
+functions were added in version 1.0 of
+.BR libj2 .
+.PP
+The
+.BR libj2_max_j2i (),
+.BR libj2_max_j2i_to_j2i (),
+.BR libj2_max_j2i_return (),
+.BR libj2_vmax_j2i (),
+.BR libj2_vmax_j2i_to_j2i (),
+and
+.BR libj2_vmax_j2i_return ()
+functions were added in version 1.1 of
+.BR libj2 .
+
+.SH SEE ALSO
+.BR libj2 (7),
+.BR libj2_min_j2i (3),
+.BR libj2_j2i_max_j2i (3),
+.BR libj2_j2i_min_j2i (3)
diff --git a/libj2_max_j2i.c b/libj2_max_j2i.c
index f8fc9ea..d26354c 100644
--- a/libj2_max_j2i.c
+++ b/libj2_max_j2i.c
@@ -3,20 +3,6 @@
#ifndef TEST
extern inline void libj2_max_j2i(struct libj2_j2i *a, ... /*, NULL */);
-/* TODO Add man pages
- libj2_max_j2i
- libj2_max_j2i_to_j2i
- libj2_max_j2i_return
- libj2_vmax_j2i
- libj2_vmax_j2i_to_j2i
- libj2_vmax_j2i_return
- libj2_max_j2u
- libj2_max_j2u_to_j2u
- libj2_max_j2u_return
- libj2_vmax_j2u
- libj2_vmax_j2u_to_j2u
- libj2_vmax_j2u_return
- */
#else
diff --git a/libj2_min_j2i.3 b/libj2_min_j2i.3
new file mode 100644
index 0000000..fca9412
--- /dev/null
+++ b/libj2_min_j2i.3
@@ -0,0 +1,144 @@
+.TH LIBJ2_MIN_J2I 3 LIBJ2
+.SH NAME
+libj2_min_j2i \- Select minimum of a set of values
+
+.SH SYNOPSIS
+.nf
+#include <libj2.h>
+
+void \fBlibj2_min_j2i\fP(struct libj2_j2i *\fIa\fP, ... /*, NULL */)
+void \fBlibj2_min_j2i_to_j2i\fP(const struct libj2_j2i *\fIa\fP, ... /*, NULL, struct libj2_j2i *\fIr\fP */)
+const struct libj2_j2i *\fBlibj2_min_j2i_return\fP(const struct libj2_j2i *\fIa\fP, ... /*, NULL */)
+void \fBlibj2_vmin_j2i\fP(struct libj2_j2i *\fIa\fP, va_list \fIargs\fP)
+void \fBlibj2_vmin_j2i_to_j2i\fP(const struct libj2_j2i *\fIa\fP, va_list \fIargs\fP)
+const struct libj2_j2i *\fBlibj2_vmin_j2i_return\fP(const struct libj2_j2i *\fIa\fP, va_list \fIargs\fP)
+void \fBlibj2_min_j2u\fP(struct libj2_j2u *\fIa\fP, ... /*, NULL */)
+void \fBlibj2_min_j2u_to_j2u\fP(const struct libj2_j2u *\fIa\fP, ... /*, NULL, struct libj2_j2u *\fIr\fP */)
+const struct libj2_j2u *\fBlibj2_min_j2u_return\fP(const struct libj2_j2u *\fIa\fP, ... /*, NULL */)
+void \fBlibj2_vmin_j2u\fP(struct libj2_j2u *\fIa\fP, va_list \fIargs\fP)
+void \fBlibj2_vmin_j2u_to_j2u\fP(const struct libj2_j2u *\fIa\fP, va_list \fIargs\fP)
+const struct libj2_j2u *\fBlibj2_vmin_j2u_return\fP(const struct libj2_j2u *\fIa\fP, va_list \fIargs\fP)
+.fi
+.PP
+Link with
+.IR -lj2 .
+
+.SH DESCRIPTION
+The above listed functions
+selects the minimum value of
+.I a
+and all follow arguments up to the first
+(and only)
+.I NULL
+argument (the so called
+.I NULL
+sentinel). For the functions with a
+.B va_list
+parameter, arguments are read from it.
+.PP
+The arguments after
+.I a
+or, for the functions with a
+.B va_list
+parameter, inside
+.I args
+must have the same type as
+.IR a ,
+except it can be
+.B const
+regardless of whether
+.I a
+is
+.BR const .
+.PP
+For the
+.BR libj2_min_j2i (),
+.BR libj2_vmin_j2i (),
+.BR libj2_min_j2u (),
+and
+.BR libj2_vmin_j2u ()
+functions, the minimum value is stored in
+.IR a .
+.PP
+For the
+.BR libj2_min_j2i_to_j2i (),
+.BR libj2_vmin_j2i_to_j2i (),
+.BR libj2_min_j2u_to_j2u (),
+and
+.BR libj2_vmin_j2u_to_j2u ()
+functions, the minimum value is stored in
+and argument, with the same type as
+.IR a ,
+except without the qualifier
+.BR const ,
+provided by the caller immediately after the
+.I NULL
+sentinel.
+.PP
+For the
+.BR libj2_min_j2i_return (),
+.BR libj2_vmin_j2i_return (),
+.BR libj2_min_j2u_return (),
+and
+.BR libj2_vmin_j2u_return ()
+functions, the argument with the minimum
+value is returned by the function. In the
+case that multiple arguments have the same
+value which is also the minimum value, one
+of the is returned arbitrarily. It is safe
+to remove the qualifier
+.BR const
+if you know that the argument with the
+minimum value did not have the qualifier
+.BR const
+const (it is the same pointer).
+.PP
+The arguments, except the sentinel in
+the varidic lists, are assumed to be
+.RI non- NULL .
+.RI ( a
+is assumed to be
+.RI non- NULL .)
+
+.SH RETURN VALUE
+For the
+.BR libj2_min_j2i_return (),
+.BR libj2_vmin_j2i_return (),
+.BR libj2_min_j2u_return (),
+and
+.BR libj2_vmin_j2u_return ()
+functions one of the arguments with the
+lowest value, is returned, for the
+other functions, there is no return value.
+
+.SH ERRORS
+The above listed functions cannot fail.
+
+.SH HISTORY
+The
+.BR libj2_min_j2u (),
+.BR libj2_min_j2u_to_j2u (),
+.BR libj2_min_j2u_return (),
+.BR libj2_vmin_j2u (),
+.BR libj2_vmin_j2u_to_j2u (),
+and
+.BR libj2_vmin_j2u_return ()
+functions were added in version 1.0 of
+.BR libj2 .
+.PP
+The
+.BR libj2_min_j2i (),
+.BR libj2_min_j2i_to_j2i (),
+.BR libj2_min_j2i_return (),
+.BR libj2_vmin_j2i (),
+.BR libj2_vmin_j2i_to_j2i (),
+and
+.BR libj2_vmin_j2i_return ()
+functions were added in version 1.1 of
+.BR libj2 .
+
+.SH SEE ALSO
+.BR libj2 (7),
+.BR libj2_max_j2i (3),
+.BR libj2_j2i_min_j2i (3),
+.BR libj2_j2i_max_j2i (3)
diff --git a/libj2_min_j2i.c b/libj2_min_j2i.c
index 9d13d12..f6238ce 100644
--- a/libj2_min_j2i.c
+++ b/libj2_min_j2i.c
@@ -3,20 +3,6 @@
#ifndef TEST
extern inline void libj2_min_j2i(struct libj2_j2i *a, ... /*, NULL */);
-/* TODO Add man pages
- libj2_min_j2i
- libj2_min_j2i_to_j2i
- libj2_min_j2i_return
- libj2_vmin_j2i
- libj2_vmin_j2i_to_j2i
- libj2_vmin_j2i_return
- libj2_min_j2u
- libj2_min_j2u_to_j2u
- libj2_min_j2u_return
- libj2_vmin_j2u
- libj2_vmin_j2u_to_j2u
- libj2_vmin_j2u_return
- */
#else
diff --git a/libj2_str_to_j2i.c b/libj2_str_to_j2i.c
index 990d3b9..7acbaca 100644
--- a/libj2_str_to_j2i.c
+++ b/libj2_str_to_j2i.c
@@ -3,7 +3,12 @@
#include <errno.h>
#ifndef TEST
-/* TODO Add man page */
+/* TODO Add man pages
+ * libj2_str_to_j2i
+ * libj2_str_to_j2u
+ * libj2_str_to_j2u_sign
+ */
+
int
libj2_str_to_j2i(const char *s, size_t slen, char **end, const char *digits1, const char *digits2, struct libj2_j2i *a)
diff --git a/libj2_str_to_j2u.3 b/libj2_str_to_j2u.3
new file mode 120000
index 0000000..113a46a
--- /dev/null
+++ b/libj2_str_to_j2u.3
@@ -0,0 +1 @@
+libj2_str_to_j2i.3 \ No newline at end of file
diff --git a/libj2_str_to_j2u.c b/libj2_str_to_j2u.c
index 80c22c3..29de1c7 100644
--- a/libj2_str_to_j2u.c
+++ b/libj2_str_to_j2u.c
@@ -3,8 +3,6 @@
#include <errno.h>
#ifndef TEST
-/* TODO Add man page */
-
extern inline int libj2_str_to_j2u(const char *str, size_t slen, char **end, const char *digits1,
const char *digits2, struct libj2_j2u *a);
diff --git a/libj2_str_to_j2u_sign.3 b/libj2_str_to_j2u_sign.3
new file mode 120000
index 0000000..113a46a
--- /dev/null
+++ b/libj2_str_to_j2u_sign.3
@@ -0,0 +1 @@
+libj2_str_to_j2i.3 \ No newline at end of file
diff --git a/libj2_str_to_j2u_sign.c b/libj2_str_to_j2u_sign.c
index 4ec0651..445142f 100644
--- a/libj2_str_to_j2u_sign.c
+++ b/libj2_str_to_j2u_sign.c
@@ -3,8 +3,6 @@
#include <errno.h>
#ifndef TEST
-/* TODO Add man page */
-
static int
from_generic(const unsigned char *s, size_t slen, const unsigned char **end,