summaryrefslogtreecommitdiff
path: root/src/headers
diff options
context:
space:
mode:
Diffstat (limited to 'src/headers')
-rw-r--r--src/headers/bits-bendian3
-rw-r--r--src/headers/bits-footer4
-rw-r--r--src/headers/bits-header6
-rw-r--r--src/headers/bits-lendian3
-rw-r--r--src/headers/bits-stdint2
-rw-r--r--src/headers/bits-template44
-rw-r--r--src/headers/gidstuff-168
-rw-r--r--src/headers/gidstuff-328
-rw-r--r--src/headers/gidstuff-648
-rw-r--r--src/headers/gidstuff-header5
-rw-r--r--src/headers/ip46-footer2
-rw-r--r--src/headers/ip46-header7
-rw-r--r--src/headers/ip46-with4
-rw-r--r--src/headers/signed-template9
-rw-r--r--src/headers/types-footer (renamed from src/headers/gidstuff-footer)0
-rw-r--r--src/headers/types-header12
-rw-r--r--src/headers/uint-1634
-rw-r--r--src/headers/uint-3234
-rw-r--r--src/headers/uint-6434
-rw-r--r--src/headers/uint-footer10
-rw-r--r--src/headers/uint-header5
-rw-r--r--src/headers/uint16-bendian3
-rw-r--r--src/headers/uint16-footer40
-rw-r--r--src/headers/uint16-header9
-rw-r--r--src/headers/uint16-lendian3
-rw-r--r--src/headers/uint32-bendian3
-rw-r--r--src/headers/uint32-footer39
-rw-r--r--src/headers/uint32-header9
-rw-r--r--src/headers/uint32-inttypesh3
-rw-r--r--src/headers/uint32-lendian3
-rw-r--r--src/headers/uint32-noulong322
-rw-r--r--src/headers/uint32-stdinth3
-rw-r--r--src/headers/uint32-ulong322
-rw-r--r--src/headers/uint64-bendian3
-rw-r--r--src/headers/uint64-footer39
-rw-r--r--src/headers/uint64-header5
-rw-r--r--src/headers/uint64-lendian3
-rw-r--r--src/headers/uint64-noulong643
-rw-r--r--src/headers/uint64-stdinth3
-rw-r--r--src/headers/uint64-ulong644
-rw-r--r--src/headers/ulong-3232
-rw-r--r--src/headers/ulong-6432
-rw-r--r--src/headers/ulong-footer10
-rw-r--r--src/headers/ulong-header5
-rw-r--r--src/headers/unsigned-template42
-rw-r--r--src/headers/ushort-1634
-rw-r--r--src/headers/ushort-3234
-rw-r--r--src/headers/ushort-footer10
-rw-r--r--src/headers/ushort-header5
49 files changed, 137 insertions, 488 deletions
diff --git a/src/headers/bits-bendian b/src/headers/bits-bendian
new file mode 100644
index 0000000..ef57f58
--- /dev/null
+++ b/src/headers/bits-bendian
@@ -0,0 +1,3 @@
+#define uint@BITS@_little_endian(s, n) uint@BITS@_reverse((s), (n))
+#define uint@BITS@_big_endian(s, n)
+
diff --git a/src/headers/bits-footer b/src/headers/bits-footer
new file mode 100644
index 0000000..b6f75a9
--- /dev/null
+++ b/src/headers/bits-footer
@@ -0,0 +1,4 @@
+
+typedef uint@BITS@_t uint@BITS@ ;
+
+#endif
diff --git a/src/headers/bits-header b/src/headers/bits-header
new file mode 100644
index 0000000..58eee22
--- /dev/null
+++ b/src/headers/bits-header
@@ -0,0 +1,6 @@
+/* ISC license. */
+
+#ifndef UINT@BITS@_H
+#define UINT@BITS@_H
+
+#include <sys/types.h>
diff --git a/src/headers/bits-lendian b/src/headers/bits-lendian
new file mode 100644
index 0000000..278af3e
--- /dev/null
+++ b/src/headers/bits-lendian
@@ -0,0 +1,3 @@
+#define uint@BITS@_little_endian(s, n)
+#define uint@BITS@_big_endian(s, n) uint16_reverse((s), (n))
+
diff --git a/src/headers/bits-stdint b/src/headers/bits-stdint
new file mode 100644
index 0000000..31da039
--- /dev/null
+++ b/src/headers/bits-stdint
@@ -0,0 +1,2 @@
+#include <stdint.h>
+
diff --git a/src/headers/bits-template b/src/headers/bits-template
new file mode 100644
index 0000000..4b43de2
--- /dev/null
+++ b/src/headers/bits-template
@@ -0,0 +1,44 @@
+extern void uint@BITS@_pack (char *, uint@BITS@_t) ;
+extern void uint@BITS@_pack_big (char *, uint@BITS@_t) ;
+extern void uint@BITS@_unpack (char const *, uint@BITS@_t *) ;
+extern void uint@BITS@_unpack_big (char const *, uint@BITS@_t *) ;
+extern void uint@BITS@_reverse (char *, size_t) ;
+
+#define UINT@BITS@_FMT @DFMT@
+#define UINT@BITS@_OFMT @OFMT@
+#define UINT@BITS@_XFMT @XFMT@
+#define UINT@BITS@_BFMT @BFMT@
+
+extern size_t uint@BITS@_fmt_base (char *, uint@BITS@_t, unsigned int) ;
+extern size_t uint@BITS@0_fmt_base (char *, uint@BITS@_t, size_t, unsigned int) ;
+
+#define uint@BITS@_fmt(s, u) uint@BITS@_fmt_base(s, (u), 10)
+#define uint@BITS@0_fmt(s, u, n) uint@BITS@0_fmt_base(s, u, (n), 10)
+#define uint@BITS@_ofmt(s, o) uint@BITS@_fmt_base(s, (o), 8)
+#define uint@BITS@0_ofmt(s, o, n) uint@BITS@0_fmt_base(s, o, (n), 8)
+#define uint@BITS@_xfmt(s, x) uint@BITS@_fmt_base(s, (x), 16)
+#define uint@BITS@0_xfmt(s, x, n) uint@BITS@0_fmt_base(s, x, (n), 16)
+#define uint@BITS@_bfmt(s, b) uint@BITS@0_fmt_base(s, (b), 2)
+#define uint@BITS@0_bfmt(s, b, n) uint@BITS@0_fmt_base(s, b, (n), 2)
+
+extern size_t uint@BITS@_fmtlist (char *, uint@BITS@_t const *, size_t) ;
+
+extern size_t uint@BITS@_scan_base (char const *, uint@BITS@_t *, unsigned int) ;
+extern size_t uint@BITS@0_scan_base (char const *, uint@BITS@_t *, unsigned int) ;
+
+#define uint@BITS@_scan(s, u) uint@BITS@_scan_base(s, (u), 10)
+#define uint@BITS@0_scan(s, u) uint@BITS@0_scan_base(s, (u), 10)
+#define uint@BITS@_oscan(s, u) uint@BITS@_scan_base(s, (u), 8)
+#define uint@BITS@0_oscan(s, u) uint@BITS@0_scan_base(s, (u), 8)
+#define uint@BITS@_xscan(s, u) uint@BITS@_scan_base(s, (u), 16)
+#define uint@BITS@0_xscan(s, u) uint@BITS@0_scan_base(s, (u), 16)
+#define uint@BITS@_bscan(s, u) uint@BITS@_scan_base(s, (u), 2)
+#define uint@BITS@0_bscan(s, u) uint@BITS@0_scan_base(s, (u), 2)
+
+extern size_t uint@BITS@_scanlist (uint@BITS@_t *, size_t, char const *, size_t *) ;
+
+extern size_t int@BITS@_fmt (char *, int@BITS@_t) ;
+extern size_t int@BITS@_fmtlist (char *, int@BITS@_t const *, size_t) ;
+extern size_t int@BITS@_scan (char const *, int@BITS@_t *) ;
+extern size_t int@BITS@0_scan (char const *, int@BITS@_t *) ;
+extern size_t int@BITS@_scanlist (int@BITS@_t *, size_t, char const *, size_t *) ;
diff --git a/src/headers/gidstuff-16 b/src/headers/gidstuff-16
deleted file mode 100644
index 438b843..0000000
--- a/src/headers/gidstuff-16
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <skalibs/uint16.h>
-
-#define GID_FMT UINT16_FMT
-#define gid_fmt(s, u) uint16_fmt(s, u)
-#define gid_scan(s, u) uint16_scan(s, u)
-#define gid0_scan(s, u) uint160_scan(s, u)
-#define gid_fmtlist(s, tab, n) uint16_fmtlist(s, tab, n)
-#define gid_scanlist(tab, max, s, num) uint16_scanlist(tab, max, s, num)
diff --git a/src/headers/gidstuff-32 b/src/headers/gidstuff-32
deleted file mode 100644
index 95a8f12..0000000
--- a/src/headers/gidstuff-32
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <skalibs/uint32.h>
-
-#define GID_FMT UINT32_FMT
-#define gid_fmt(s, u) uint32_fmt(s, u)
-#define gid_scan(s, u) uint32_scan(s, u)
-#define gid0_scan(s, u) uint320_scan(s, u)
-#define gid_fmtlist(s, tab, n) uint32_fmtlist(s, tab, n)
-#define gid_scanlist(tab, max, s, num) uint32_scanlist(tab, max, s, num)
diff --git a/src/headers/gidstuff-64 b/src/headers/gidstuff-64
deleted file mode 100644
index 92b869e..0000000
--- a/src/headers/gidstuff-64
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <skalibs/uint64.h>
-
-#define GID_FMT UINT64_FMT
-#define gid_fmt(s, u) uint64_fmt(s, u)
-#define gid_scan(s, u) uint64_scan(s, u)
-#define gid0_scan(s, u) uint640_scan(s, u)
-#define gid_fmtlist(s, tab, n) uint64_fmtlist(s, tab, n)
-#define gid_scanlist(tab, max, s, num) uint64_scanlist(tab, max, s, num)
diff --git a/src/headers/gidstuff-header b/src/headers/gidstuff-header
deleted file mode 100644
index 73bf86b..0000000
--- a/src/headers/gidstuff-header
+++ /dev/null
@@ -1,5 +0,0 @@
-/* ISC license. */
-
-#ifndef GIDSTUFF_H
-#define GIDSTUFF_H
-
diff --git a/src/headers/ip46-footer b/src/headers/ip46-footer
index 4340daf..4be22b5 100644
--- a/src/headers/ip46-footer
+++ b/src/headers/ip46-footer
@@ -4,7 +4,7 @@
#define socket_recvnb46_g(fd, buf, len, i, port, deadline) socket_recvnb46(fd, buf, len, i, port, (deadline), &STAMP)
#define socket_sendnb46_g(fd, buf, len, i, port, deadline) socket_sendnb46(fd, buf, len, i, port, (deadline), &STAMP)
-extern int socket_deadlineconnstamp46 (int, ip46_t const *, uint16, tain_t const *, tain_t *) ;
+extern int socket_deadlineconnstamp46 (int, ip46_t const *, uint16_t, tain_t const *, tain_t *) ;
#define socket_deadlineconnstamp46_g(fd, ip, port, deadline) socket_deadlineconnstamp46(fd, ip, port, (deadline), &STAMP)
#endif
diff --git a/src/headers/ip46-header b/src/headers/ip46-header
index ba310d3..91d0c86 100644
--- a/src/headers/ip46-header
+++ b/src/headers/ip46-header
@@ -3,8 +3,9 @@
#ifndef IP46_H
#define IP46_H
+#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
#include <skalibs/bytestr.h>
#include <skalibs/fmtscan.h>
#include <skalibs/tai.h>
@@ -27,8 +28,8 @@ struct ip46full_s
#define ip46full_is6(i) ((i)->is6)
#define ip46full_fmt(s, i) ((i)->is6 ? ip6_fmt(s, (i)->ip) : ip4_fmt(s, (i)->ip))
-extern unsigned int ip46full_scan (char const *, ip46full_t *) ;
-extern unsigned int ip46full_scanlist (ip46full_t *, unsigned int, char const *, unsigned int *) ;
+extern size_t ip46full_scan (char const *, ip46full_t *) ;
+extern size_t ip46full_scanlist (ip46full_t *, size_t, char const *, size_t *) ;
#define ip46full_from_ip4(i, ip4) (byte_copy((i)->ip, 4, ip4), byte_zero((i)->ip + 4, 12), (i)->is6 = 0)
#define ip46full_from_ip6(i, ip6) (byte_copy((i)->ip, 16, ip6), (i)->is6 = 1)
diff --git a/src/headers/ip46-with b/src/headers/ip46-with
index 8ff6752..9570ffa 100644
--- a/src/headers/ip46-with
+++ b/src/headers/ip46-with
@@ -17,8 +17,8 @@ typedef ip46full_t ip46_t, *ip46_t_ref ;
#define socket_udp46(h) ((h) ? socket_udp6() : socket_udp4())
#define socket_recv46(fd, s, len, i, port) ((i)->is6 ? socket_recv6(fd, s, len, (i)->ip, port) : socket_recv4(fd, s, len, (i)->ip, port))
#define socket_send46(fd, s, len, i, port) ((i)->is6 ? socket_send6(fd, s, len, (i)->ip, port) : socket_send4(fd, s, len, (i)->ip, port))
-extern int socket_local46 (int, ip46_t *, uint16 *) ;
-extern int socket_remote46 (int, ip46_t *, uint16 *) ;
+extern int socket_local46 (int, ip46_t *, uint16_t *) ;
+extern int socket_remote46 (int, ip46_t *, uint16_t *) ;
#define socket_recvnb46(fd, buf, len, i, port, deadline, stamp) ((i)->is6 ? socket_recvnb6(fd, buf, len, (i)->ip, port, deadline, stamp) : socket_recvnb4(fd, buf, len, (i)->ip, port, deadline, stamp))
#define socket_sendnb46(fd, buf, len, i, port, deadline, stamp) ((i)->is6 ? socket_sendnb6(fd, buf, len, (i)->ip, port, deadline, stamp) : socket_sendnb4(fd, buf, len, (i)->ip, port, deadline, stamp))
diff --git a/src/headers/signed-template b/src/headers/signed-template
new file mode 100644
index 0000000..2ef6fdd
--- /dev/null
+++ b/src/headers/signed-template
@@ -0,0 +1,9 @@
+#define @TYPE@_FMT (1+UINT@BITS@_FMT)
+
+#define @type@_fmt int@BITS@_fmt
+#define @type@_fmtlist int@BITS@_fmtlist
+#define @type@_scan int@BITS@_scan
+#define @type@0_scan int@BITS@0_scan
+#define @type@_scanlist int@BITS@_scanlist
+
+
diff --git a/src/headers/gidstuff-footer b/src/headers/types-footer
index ddd5dae..ddd5dae 100644
--- a/src/headers/gidstuff-footer
+++ b/src/headers/types-footer
diff --git a/src/headers/types-header b/src/headers/types-header
new file mode 100644
index 0000000..015bb08
--- /dev/null
+++ b/src/headers/types-header
@@ -0,0 +1,12 @@
+/* ISC license. */
+
+#ifndef SKALIBS_TYPES_H
+#define SKALIBS_TYPES_H
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <skalibs/uint16.h>
+#include <skalibs/uint32.h>
+#include <skalibs/uint64.h>
+
+
diff --git a/src/headers/uint-16 b/src/headers/uint-16
deleted file mode 100644
index 85434db..0000000
--- a/src/headers/uint-16
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <skalibs/uint16.h>
-
-#define UINT_PACK 2
-#define uint_pack uint16_pack
-#define uint_pack_big uint16_pack_big
-#define uint_unpack(s, u) uint16_unpack(s, (uint16 *)(char *)(u))
-#define uint_unpack_big(s, u) uint16_unpack_big(s, (uint16 *)(char *)(u))
-
-#define uint_reverse uint16_reverse
-#define uint_big_endian uint16_big_endian
-#define uint_little_endian uint16_little_endian
-
-#define UINT_FMT UINT16_FMT
-#define UINT_OFMT UINT16_OFMT
-#define UINT_XFMT UINT16_XFMT
-#define UINT_BFMT UINT16_BFMT
-
-#define uint_fmt_base uint16_fmt_base
-#define uint0_fmt_base uint160_fmt_base
-#define uint_fmt uint16_fmt
-#define uint0_fmt uint160_fmt
-#define uint_ofmt uint16_ofmt
-#define uint0_ofmt uint160_ofmt
-#define uint_xfmt uint16_xfmt
-#define uint0_xfmt uint160_xfmt
-#define uint_bfmt uint16_bfmt
-#define uint0_bfmt uint160_bfmt
-
-#define uint_fmtlist(s, tab, n) uint16_fmtlist(s, tab, n)
-
-#define uint_scan_base(s, u, b) uint16_scan_base(s, (uint16 *)(char *)(u), b)
-#define uint0_scan_base(s, u, b) uint160_scan_base(s, (uint16 *)(char *)(u), b)
-
-#define uint_scanlist(tab, max, s, num) uint16_scanlist(tab, max, s, num)
diff --git a/src/headers/uint-32 b/src/headers/uint-32
deleted file mode 100644
index 32c6600..0000000
--- a/src/headers/uint-32
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <skalibs/uint32.h>
-
-#define UINT_PACK 4
-#define uint_pack uint32_pack
-#define uint_pack_big uint32_pack_big
-#define uint_unpack(s, u) uint32_unpack(s, (uint32 *)(char *)(u))
-#define uint_unpack_big(s, u) uint32_unpack_big(s, (uint32 *)(char *)(u))
-
-#define uint_reverse uint32_reverse
-#define uint_big_endian uint32_big_endian
-#define uint_little_endian uint32_little_endian
-
-#define UINT_FMT UINT32_FMT
-#define UINT_OFMT UINT32_OFMT
-#define UINT_XFMT UINT32_XFMT
-#define UINT_BFMT UINT32_BFMT
-
-#define uint_fmt_base uint32_fmt_base
-#define uint0_fmt_base uint320_fmt_base
-#define uint_fmt uint32_fmt
-#define uint0_fmt uint320_fmt
-#define uint_ofmt uint32_ofmt
-#define uint0_ofmt uint320_ofmt
-#define uint_xfmt uint32_xfmt
-#define uint0_xfmt uint320_xfmt
-#define uint_bfmt uint32_bfmt
-#define uint0_bfmt uint320_bfmt
-
-#define uint_fmtlist(s, tab, n) uint32_fmtlist(s, tab, n)
-
-#define uint_scan_base(s, u, b) uint32_scan_base(s, (uint32 *)(char *)(u), b)
-#define uint0_scan_base(s, u, b) uint320_scan_base(s, (uint32 *)(char *)(u), b)
-
-#define uint_scanlist(tab, max, s, num) uint32_scanlist(tab, max, s, num)
diff --git a/src/headers/uint-64 b/src/headers/uint-64
deleted file mode 100644
index 31926d9..0000000
--- a/src/headers/uint-64
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <skalibs/uint64.h>
-
-#define UINT_PACK 8
-#define uint_pack uint64_pack
-#define uint_pack_big uint64_pack_big
-#define uint_unpack(s, u) uint64_unpack(s, (uint64 *)(char *)(u))
-#define uint_unpack_big(s, u) uint64_unpack_big(s, (uint64 *)(char *)(u))
-
-#define uint_reverse uint64_reverse
-#define uint_big_endian uint64_big_endian
-#define uint_little_endian uint64_little_endian
-
-#define UINT_FMT UINT64_FMT
-#define UINT_OFMT UINT64_OFMT
-#define UINT_XFMT UINT64_XFMT
-#define UINT_BFMT UINT64_BFMT
-
-#define uint_fmt_base uint64_fmt_base
-#define uint0_fmt_base uint640_fmt_base
-#define uint_fmt uint64_fmt
-#define uint0_fmt uint640_fmt
-#define uint_ofmt uint64_ofmt
-#define uint0_ofmt uint640_ofmt
-#define uint_xfmt uint64_xfmt
-#define uint0_xfmt uint640_xfmt
-#define uint_bfmt uint64_bfmt
-#define uint0_bfmt uint640_bfmt
-
-#define uint_fmtlist(s, tab, n) uint64_fmtlist(s, tab, n)
-
-#define uint_scan_base(s, u, b) uint64_scan_base(s, (uint64 *)(char *)(u), b)
-#define uint0_scan_base(s, u, b) uint640_scan_base(s, (uint64 *)(char *)(u), b)
-
-#define uint_scanlist(tab, max, s, num) uint64_scanlist(tab, max, s, num)
diff --git a/src/headers/uint-footer b/src/headers/uint-footer
deleted file mode 100644
index 68bbaf7..0000000
--- a/src/headers/uint-footer
+++ /dev/null
@@ -1,10 +0,0 @@
-#define uint_scan(s, u) uint_scan_base(s, (u), 10)
-#define uint0_scan(s, u) uint0_scan_base(s, (u), 10)
-#define uint_oscan(s, u) uint_scan_base(s, (u), 8)
-#define uint0_oscan(s, u) uint0_scan_base(s, (u), 8)
-#define uint_xscan(s, u) uint_scan_base(s, (u), 16)
-#define uint0_xscan(s, u) uint0_scan_base(s, (u), 16)
-#define uint_bscan(s, u) uint_scan_base(s, (u), 2)
-#define uint0_bscan(s, u) uint0_scan_base(s, (u), 2)
-
-#endif
diff --git a/src/headers/uint-header b/src/headers/uint-header
deleted file mode 100644
index 8136b0c..0000000
--- a/src/headers/uint-header
+++ /dev/null
@@ -1,5 +0,0 @@
-/* ISC license. */
-
-#ifndef UINT_H
-#define UINT_H
-
diff --git a/src/headers/uint16-bendian b/src/headers/uint16-bendian
deleted file mode 100644
index e1d0427..0000000
--- a/src/headers/uint16-bendian
+++ /dev/null
@@ -1,3 +0,0 @@
-#define uint16_little_endian(s, n) uint16_reverse((s), (n))
-#define uint16_big_endian(s, n)
-
diff --git a/src/headers/uint16-footer b/src/headers/uint16-footer
deleted file mode 100644
index 5602571..0000000
--- a/src/headers/uint16-footer
+++ /dev/null
@@ -1,40 +0,0 @@
-
-extern void uint16_pack (char *, uint16) ;
-extern void uint16_pack_big (char *, uint16) ;
-extern void uint16_unpack (char const *, uint16 *) ;
-extern void uint16_unpack_big (char const *, uint16 *) ;
-extern void uint16_reverse (char *, unsigned int) ;
-
-#define UINT16_FMT 6
-#define UINT16_OFMT 7
-#define UINT16_XFMT 5
-#define UINT16_BFMT 17
-
-#define uint16_fmt_base(s, u, b) uint64_fmt_base(s, (uint64)(uint16)(u), b)
-#define uint160_fmt_base(s, u, n, b) uint640_fmt_base(s, (uint64)(uint16)(u), n, b)
-
-#define uint16_fmt(s, u) uint64_fmt(s, (uint64)(uint16)(u))
-#define uint160_fmt(s, u, n) uint64_fmt(s, (uint64)(uint16)(u), n)
-#define uint16_ofmt(s, o) uint64_ofmt(s, (uint64)(uint16)(o))
-#define uint160_ofmt(s, o, n) uint64_ofmt(s, (uint64)(uint16)(o), n)
-#define uint16_xfmt(s, x) uint64_xfmt(s, (uint64)(uint16)(x))
-#define uint160_xfmt(s, x, n) uint64_xfmt(s, (uint64)(uint16)(x), n)
-#define uint16_bfmt(s, b) uint64_bfmt(s, (uint64)(uint16)(b))
-#define uint160_bfmt(s, b, n) uint64_bfmt(s, (uint64)(uint16)(b), n)
-
-extern unsigned int uint16_fmtlist (char *, uint16 const *, unsigned int) ;
-
-extern unsigned int uint16_scan_base (char const *, uint16 *, unsigned char) ;
-extern unsigned int uint160_scan_base (char const *, uint16 *, unsigned char) ;
-#define uint16_scan(s, u) uint16_scan_base(s, (u), 10)
-#define uint160_scan(s, u) uint160_scan_base(s, (u), 10)
-#define uint16_oscan(s, u) uint16_scan_base(s, (u), 8)
-#define uint160_oscan(s, u) uint160_scan_base(s, (u), 8)
-#define uint16_xscan(s, u) uint16_scan_base(s, (u), 16)
-#define uint160_xscan(s, u) uint160_scan_base(s, (u), 16)
-#define uint16_bscan(s, u) uint16_scan_base(s, (u), 2)
-#define uint160_bscan(s, u) uint160_scan_base(s, (u), 2)
-
-extern unsigned int uint16_scanlist (uint16 *, unsigned int, char const *, unsigned int *) ;
-
-#endif
diff --git a/src/headers/uint16-header b/src/headers/uint16-header
deleted file mode 100644
index a8058c6..0000000
--- a/src/headers/uint16-header
+++ /dev/null
@@ -1,9 +0,0 @@
-/* ISC license. */
-
-#ifndef UINT16_H
-#define UINT16_H
-
-#include <stdint.h>
-#include <skalibs/uint64.h>
-
-typedef uint16_t uint16 ;
diff --git a/src/headers/uint16-lendian b/src/headers/uint16-lendian
deleted file mode 100644
index a9f9945..0000000
--- a/src/headers/uint16-lendian
+++ /dev/null
@@ -1,3 +0,0 @@
-#define uint16_little_endian(s, n)
-#define uint16_big_endian(s, n) uint16_reverse((s), (n))
-
diff --git a/src/headers/uint32-bendian b/src/headers/uint32-bendian
deleted file mode 100644
index 27903c7..0000000
--- a/src/headers/uint32-bendian
+++ /dev/null
@@ -1,3 +0,0 @@
-#define uint32_little_endian(s, n) uint32_reverse((s), (n))
-#define uint32_big_endian(s, n)
-
diff --git a/src/headers/uint32-footer b/src/headers/uint32-footer
deleted file mode 100644
index 7cfe7ba..0000000
--- a/src/headers/uint32-footer
+++ /dev/null
@@ -1,39 +0,0 @@
-extern void uint32_pack (char *, uint32) ;
-extern void uint32_pack_big (char *, uint32) ;
-extern void uint32_unpack (char const *, uint32 *) ;
-extern void uint32_unpack_big (char const *, uint32 *) ;
-extern void uint32_reverse (char *, unsigned int) ;
-
-#define UINT32_FMT 11
-#define UINT32_OFMT 13
-#define UINT32_XFMT 9
-#define UINT32_BFMT 33
-
-#define uint32_fmt_base(s, u, b) uint64_fmt_base(s, (uint64)(uint32)(u), b)
-#define uint320_fmt_base(s, u, n, b) uint640_fmt_base(s, (uint64)(uint32)(u), n, b)
-
-#define uint32_fmt(s, u) uint64_fmt(s, (uint64)(uint32)(u))
-#define uint320_fmt(s, u, n) uint640_fmt(s, (uint64)(uint32)(u), n)
-#define uint32_ofmt(s, o) uint64_ofmt(s, (uint64)(uint32)(o))
-#define uint320_ofmt(s, o, n) uint640_ofmt(s, (uint64)(uint32)(o), n)
-#define uint32_xfmt(s, x) uint64_xfmt(s, (uint64)(uint32)(x))
-#define uint320_xfmt(s, x, n) uint640_xfmt(s, (uint64)(uint32)(x), n)
-#define uint32_bfmt(s, b) uint64_bfmt(s, (uint64)(uint32)(b))
-#define uint320_bfmt(s, b, n) uint640_bfmt(s, (uint64)(uint32)(b), n)
-
-extern unsigned int uint32_fmtlist (char *, uint32 const *, unsigned int) ;
-
-extern unsigned int uint32_scan_base (char const *, uint32 *, unsigned char) ;
-extern unsigned int uint320_scan_base (char const *, uint32 *, unsigned char) ;
-#define uint32_scan(s, u) uint32_scan_base(s, (u), 10)
-#define uint320_scan(s, u) uint320_scan_base(s, (u), 10)
-#define uint32_oscan(s, u) uint32_scan_base(s, (u), 8)
-#define uint320_oscan(s, u) uint320_scan_base(s, (u), 8)
-#define uint32_xscan(s, u) uint32_scan_base(s, (u), 16)
-#define uint320_xscan(s, u) uint320_scan_base(s, (u), 16)
-#define uint32_bscan(s, u) uint32_scan_base(s, (u), 2)
-#define uint320_bscan(s, u) uint320_scan_base(s, (u), 2)
-
-extern unsigned int uint32_scanlist (uint32 *, unsigned int, char const *, unsigned int *) ;
-
-#endif
diff --git a/src/headers/uint32-header b/src/headers/uint32-header
deleted file mode 100644
index f71267f..0000000
--- a/src/headers/uint32-header
+++ /dev/null
@@ -1,9 +0,0 @@
-/* ISC license. */
-
-#ifndef UINT32_H
-#define UINT32_H
-
-#include <stdint.h>
-#include <skalibs/uint64.h>
-
-typedef uint32_t uint32 ;
diff --git a/src/headers/uint32-inttypesh b/src/headers/uint32-inttypesh
deleted file mode 100644
index 47a8910..0000000
--- a/src/headers/uint32-inttypesh
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <inttypes.h>
-typedef uint32_t uint32 ;
-
diff --git a/src/headers/uint32-lendian b/src/headers/uint32-lendian
deleted file mode 100644
index f88c111..0000000
--- a/src/headers/uint32-lendian
+++ /dev/null
@@ -1,3 +0,0 @@
-#define uint32_little_endian(s, n)
-#define uint32_big_endian(s, n) uint32_reverse((s), (n))
-
diff --git a/src/headers/uint32-noulong32 b/src/headers/uint32-noulong32
deleted file mode 100644
index 4705047..0000000
--- a/src/headers/uint32-noulong32
+++ /dev/null
@@ -1,2 +0,0 @@
-typedef unsigned int uint32 ;
-
diff --git a/src/headers/uint32-stdinth b/src/headers/uint32-stdinth
deleted file mode 100644
index dc9eb42..0000000
--- a/src/headers/uint32-stdinth
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdint.h>
-typedef uint32_t uint32 ;
-
diff --git a/src/headers/uint32-ulong32 b/src/headers/uint32-ulong32
deleted file mode 100644
index 87119a5..0000000
--- a/src/headers/uint32-ulong32
+++ /dev/null
@@ -1,2 +0,0 @@
-typedef unsigned long uint32 ;
-
diff --git a/src/headers/uint64-bendian b/src/headers/uint64-bendian
deleted file mode 100644
index 2485bec..0000000
--- a/src/headers/uint64-bendian
+++ /dev/null
@@ -1,3 +0,0 @@
-#define uint64_little_endian(s, n) uint64_reverse((s), (n))
-#define uint64_big_endian(s, n)
-
diff --git a/src/headers/uint64-footer b/src/headers/uint64-footer
deleted file mode 100644
index df620a5..0000000
--- a/src/headers/uint64-footer
+++ /dev/null
@@ -1,39 +0,0 @@
-extern void uint64_pack (char *, uint64) ;
-extern void uint64_pack_big (char *, uint64) ;
-extern void uint64_unpack (char const *, uint64 *) ;
-extern void uint64_unpack_big (char const *, uint64 *) ;
-extern void uint64_reverse (char *, unsigned int) ;
-
-#define UINT64_FMT 21
-#define UINT64_OFMT 25
-#define UINT64_XFMT 17
-#define UINT64_BFMT 65
-
-extern unsigned int uint64_fmt_base (char *, uint64, unsigned char) ;
-extern unsigned int uint640_fmt_base (char *, uint64, unsigned int, unsigned char) ;
-
-#define uint64_fmt(s, u) uint64_fmt_base(s, (u), 10)
-#define uint640_fmt(s, u, n) uint640_fmt_base(s, u, (n), 10)
-#define uint64_ofmt(s, u) uint64_fmt_base(s, (u), 8)
-#define uint640_ofmt(s, u, n) uint640_fmt_base(s, u, (n), 8)
-#define uint64_xfmt(s, u) uint64_fmt_base(s, (u), 16)
-#define uint640_xfmt(s, u, n) uint640_fmt_base(s, u, (n), 16)
-#define uint64_bfmt(s, u) uint64_fmt_base(s, (u), 2)
-#define uint640_bfmt(s, u, n) uint640_fmt_base(s, u, (n), 2)
-
-extern unsigned int uint64_fmtlist (char *, uint64 const *, unsigned int) ;
-
-extern unsigned int uint64_scan_base (char const *, uint64 *, unsigned char) ;
-extern unsigned int uint640_scan_base (char const *, uint64 *, unsigned char) ;
-#define uint64_scan(s, u) uint64_scan_base(s, (u), 10)
-#define uint640_scan(s, u) uint640_scan_base(s, (u), 10)
-#define uint64_oscan(s, u) uint64_scan_base(s, (u), 8)
-#define uint640_oscan(s, u) uint640_scan_base(s, (u), 8)
-#define uint64_xscan(s, u) uint64_scan_base(s, (u), 16)
-#define uint640_xscan(s, u) uint640_scan_base(s, (u), 16)
-#define uint64_bscan(s, u) uint64_scan_base(s, (u), 2)
-#define uint640_bscan(s, u) uint640_scan_base(s, (u), 2)
-
-extern unsigned int uint64_scanlist (uint64 *, unsigned int, char const *, unsigned int *) ;
-
-#endif
diff --git a/src/headers/uint64-header b/src/headers/uint64-header
deleted file mode 100644
index f0f10e6..0000000
--- a/src/headers/uint64-header
+++ /dev/null
@@ -1,5 +0,0 @@
-/* ISC license. */
-
-#ifndef UINT64_H
-#define UINT64_H
-
diff --git a/src/headers/uint64-lendian b/src/headers/uint64-lendian
deleted file mode 100644
index ffdb4de..0000000
--- a/src/headers/uint64-lendian
+++ /dev/null
@@ -1,3 +0,0 @@
-#define uint64_little_endian(s, n)
-#define uint64_big_endian(s, n) uint64_reverse((s), (n))
-
diff --git a/src/headers/uint64-noulong64 b/src/headers/uint64-noulong64
index c72ebef..1a67c1d 100644
--- a/src/headers/uint64-noulong64
+++ b/src/headers/uint64-noulong64
@@ -1,2 +1,3 @@
-typedef unsigned long long uint64 ;
+
+typedef unsigned long long uint64_t ;
diff --git a/src/headers/uint64-stdinth b/src/headers/uint64-stdinth
deleted file mode 100644
index 9c43f44..0000000
--- a/src/headers/uint64-stdinth
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdint.h>
-
-typedef uint64_t uint64 ;
diff --git a/src/headers/uint64-ulong64 b/src/headers/uint64-ulong64
index d9313d4..84ae235 100644
--- a/src/headers/uint64-ulong64
+++ b/src/headers/uint64-ulong64
@@ -1 +1,3 @@
-typedef unsigned long uint64 ;
+
+typedef unsigned long uint64_t ;
+
diff --git a/src/headers/ulong-32 b/src/headers/ulong-32
deleted file mode 100644
index b1b3326..0000000
--- a/src/headers/ulong-32
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <skalibs/uint32.h>
-
-#define ULONG_PACK 4
-#define ulong_pack uint32_pack
-#define ulong_pack_big uint32_pack_big
-#define ulong_unpack(s, u) uint32_unpack(s, (uint32 *)(char *)(u))
-#define ulong_unpack_big(s, u) uint32_unpack_big(s, (uint32 *)(char *)(u))
-
-#define ulong_reverse uint32_reverse
-#define ulong_big_endian uint32_big_endian
-#define ulong_little_endian uint32_little_endian
-
-#define ULONG_FMT UINT32_FMT
-#define ULONG_OFMT UINT32_OFMT
-#define ULONG_XFMT UINT32_XFMT
-#define ULONG_BFMT UINT32_BFMT
-
-#define ulong_fmt uint32_fmt
-#define ulong0_fmt uint320_fmt
-#define ulong_ofmt uint32_ofmt
-#define ulong0_ofmt uint320_ofmt
-#define ulong_xfmt uint32_xfmt
-#define ulong0_xfmt uint320_xfmt
-#define ulong_bfmt uint32_bfmt
-#define ulong0_bfmt uint320_bfmt
-
-#define ulong_fmtlist(s, tab, n) uint32_fmtlist(s, tab, n)
-
-#define ulong_scan_base(s, u, b) uint32_scan_base(s, (uint32 *)(char *)(u), b)
-#define ulong0_scan_base(s, u, b) uint320_scan_base(s, (uint32 *)(char *)(u), b)
-
-#define ulong_scanlist(tab, max, s, num) uint32_scanlist(tab, max, s, num)
diff --git a/src/headers/ulong-64 b/src/headers/ulong-64
deleted file mode 100644
index 016fd1f..0000000
--- a/src/headers/ulong-64
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <skalibs/uint64.h>
-
-#define ULONG_PACK 8
-#define ulong_pack uint64_pack
-#define ulong_pack_big uint64_pack_big
-#define ulong_unpack(s, u) uint64_unpack(s, (uint64 *)(char *)(u))
-#define ulong_unpack_big(s, u) uint64_unpack_big(s, (uint64 *)(char *)(u))
-
-#define ulong_reverse uint64_reverse
-#define ulong_big_endian uint64_big_endian
-#define ulong_little_endian uint64_little_endian
-
-#define ULONG_FMT UINT64_FMT
-#define ULONG_OFMT UINT64_OFMT
-#define ULONG_XFMT UINT64_XFMT
-#define ULONG_BFMT UINT64_BFMT
-
-#define ulong_fmt uint64_fmt
-#define ulong0_fmt uint640_fmt
-#define ulong_ofmt uint64_ofmt
-#define ulong0_ofmt uint640_ofmt
-#define ulong_xfmt uint64_xfmt
-#define ulong0_xfmt uint640_xfmt
-#define ulong_bfmt uint64_bfmt
-#define ulong0_bfmt uint640_bfmt
-
-#define ulong_fmtlist(s, tab, n) uint64_fmtlist(s, tab, n)
-
-#define ulong_scan_base(s, u, b) uint64_scan_base(s, (uint64 *)(char *)(u), b)
-#define ulong0_scan_base(s, u, b) uint640_scan_base(s, (uint64 *)(char *)(u), b)
-
-#define ulong_scanlist(tab, max, s, num) uint64_scanlist(tab, max, s, num)
diff --git a/src/headers/ulong-footer b/src/headers/ulong-footer
deleted file mode 100644
index 0607872..0000000
--- a/src/headers/ulong-footer
+++ /dev/null
@@ -1,10 +0,0 @@
-#define ulong_scan(s, u) ulong_scan_base(s, (u), 10)
-#define ulong0_scan(s, u) ulong0_scan_base(s, (u), 10)
-#define ulong_oscan(s, u) ulong_scan_base(s, (u), 8)
-#define ulong0_oscan(s, u) ulong0_scan_base(s, (u), 8)
-#define ulong_xscan(s, u) ulong_scan_base(s, (u), 16)
-#define ulong0_xscan(s, u) ulong0_scan_base(s, (u), 16)
-#define ulong_bscan(s, u) ulong_scan_base(s, (u), 2)
-#define ulong0_bscan(s, u) ulong0_scan_base(s, (u), 2)
-
-#endif
diff --git a/src/headers/ulong-header b/src/headers/ulong-header
deleted file mode 100644
index 98e6f37..0000000
--- a/src/headers/ulong-header
+++ /dev/null
@@ -1,5 +0,0 @@
-/* ISC license. */
-
-#ifndef ULONG_H
-#define ULONG_H
-
diff --git a/src/headers/unsigned-template b/src/headers/unsigned-template
new file mode 100644
index 0000000..8ef6db4
--- /dev/null
+++ b/src/headers/unsigned-template
@@ -0,0 +1,42 @@
+#define @TYPE@_PACK @BYTES@
+#define @type@_pack uint@BITS@_pack
+#define @type@_pack_big uint@BITS@_pack_big
+#define @type@_unpack uint@BITS@_unpack
+#define @type@_unpack_big uint@BITS@_unpack_big
+
+#define @type@_reverse uint@BITS@_reverse
+#define @type@_big_endian uint@BITS@_big_endian
+#define @type@_little_endian uint@BITS@_little_endian
+
+#define @TYPE@_FMT UINT@BITS@_FMT
+#define @TYPE@_OFMT UINT@BITS@_OFMT
+#define @TYPE@_XFMT UINT@BITS@_XFMT
+#define @TYPE@_BFMT UINT@BITS@_BFMT
+
+#define @type@_fmt_base uint@BITS@_fmt_base
+#define @type@0_fmt_base uint@BITS@0_fmt_base
+#define @type@_fmt uint@BITS@_fmt
+#define @type@0_fmt uint@BITS@0_fmt
+#define @type@_ofmt uint@BITS@_ofmt
+#define @type@0_ofmt uint@BITS@0_ofmt
+#define @type@_xfmt uint@BITS@_xfmt
+#define @type@0_xfmt uint@BITS@0_xfmt
+#define @type@_bfmt uint@BITS@_bfmt
+#define @type@0_bfmt uint@BITS@0_bfmt
+
+#define @type@_fmtlist uint@BITS@_fmtlist
+
+#define @type@_scan_base uint@BITS@_scan_base
+#define @type@0_scan_base uint@BITS@0_scan_base
+#define @type@_scanlist uint@BITS@_scanlist
+
+#define @type@_scan(s, u) @type@_scan_base(s, (u), 10)
+#define @type@0_scan(s, u) @type@0_scan_base(s, (u), 10)
+#define @type@_oscan(s, u) @type@_scan_base(s, (u), 8)
+#define @type@0_oscan(s, u) @type@0_scan_base(s, (u), 8)
+#define @type@_xscan(s, u) @type@_scan_base(s, (u), 16)
+#define @type@0_xscan(s, u) @type@0_scan_base(s, (u), 16)
+#define @type@_bscan(s, u) @type@_scan_base(s, (u), 2)
+#define @type@0_bscan(s, u) @type@0_scan_base(s, (u), 2)
+
+
diff --git a/src/headers/ushort-16 b/src/headers/ushort-16
deleted file mode 100644
index 0e210c6..0000000
--- a/src/headers/ushort-16
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <skalibs/uint16.h>
-
-#define USHORT_PACK 2
-#define ushort_pack uint16_pack
-#define ushort_pack_big uint16_pack_big
-#define ushort_unpack(s, u) uint16_unpack(s, (uint16 *)(char *)(u))
-#define ushort_unpack_big(s, u) uint16_unpack_big(s, (uint16 *)(char *)(u))
-
-#define ushort_reverse uint16_reverse
-#define ushort_big_endian uint16_big_endian
-#define ushort_little_endian uint16_little_endian
-
-#define USHORT_FMT UINT16_FMT
-#define USHORT_OFMT UINT16_OFMT
-#define USHORT_XFMT UINT16_XFMT
-#define USHORT_BFMT UINT16_BFMT
-
-#define ushort_fmt_base uint16_fmt_base
-#define ushort0_fmt_base uint160_fmt_base
-#define ushort_fmt uint16_fmt
-#define ushort0_fmt uint160_fmt
-#define ushort_ofmt uint16_ofmt
-#define ushort0_ofmt uint160_ofmt
-#define ushort_xfmt uint16_xfmt
-#define ushort0_xfmt uint160_xfmt
-#define ushort_bfmt uint16_bfmt
-#define ushort0_bfmt uint160_bfmt
-
-#define ushort_fmtlist(s, tab, n) uint16_fmtlist(s, tab, n)
-
-#define ushort_scan_base(s, u, b) uint16_scan_base(s, (uint16 *)(char *)(u), b)
-#define ushort0_scan_base(s, u, b) uint160_scan_base(s, (uint16 *)(char *)(u), b)
-
-#define ushort_scanlist(tab, max, s, num) uint16_scanlist(tab, max, s, num)
diff --git a/src/headers/ushort-32 b/src/headers/ushort-32
deleted file mode 100644
index b41aef4..0000000
--- a/src/headers/ushort-32
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <skalibs/uint32.h>
-
-#define USHORT_PACK 4
-#define ushort_pack uint32_pack
-#define ushort_pack_big uint32_pack_big
-#define ushort_unpack(s, u) uint32_unpack(s, (uint32 *)(char *)(u))
-#define ushort_unpack_big(s, u) uint32_unpack_big(s, (uint32 *)(char *)(u))
-
-#define ushort_reverse uint32_reverse
-#define ushort_big_endian uint32_big_endian
-#define ushort_little_endian uint32_little_endian
-
-#define USHORT_FMT UINT32_FMT
-#define USHORT_OFMT UINT32_OFMT
-#define USHORT_XFMT UINT32_XFMT
-#define USHORT_BFMT UINT32_BFMT
-
-#define ushort_fmt_base uint32_fmt_base
-#define ushort0_fmt_base uint320_fmt_base
-#define ushort_fmt uint32_fmt
-#define ushort0_fmt uint320_fmt
-#define ushort_ofmt uint32_ofmt
-#define ushort0_ofmt uint320_ofmt
-#define ushort_xfmt uint32_xfmt
-#define ushort0_xfmt uint320_xfmt
-#define ushort_bfmt uint32_bfmt
-#define ushort0_bfmt uint320_bfmt
-
-#define ushort_fmtlist(s, tab, n) uint32_fmtlist(s, tab, n)
-
-#define ushort_scan_base(s, u, b) uint32_scan_base(s, (uint32 *)(char *)(u), b)
-#define ushort0_scan_base(s, u, b) uint320_scan_base(s, (uint32 *)(char *)(u), b)
-
-#define ushort_scanlist(tab, max, s, num) uint32_scanlist(tab, max, s, num)
diff --git a/src/headers/ushort-footer b/src/headers/ushort-footer
deleted file mode 100644
index db56f73..0000000
--- a/src/headers/ushort-footer
+++ /dev/null
@@ -1,10 +0,0 @@
-#define ushort_scan(s, u) ushort_scan_base(s, (u), 10)
-#define ushort0_scan(s, u) ushort0_scan_base(s, (u), 10)
-#define ushort_oscan(s, u) ushort_scan_base(s, (u), 8)
-#define ushort0_oscan(s, u) ushort0_scan_base(s, (u), 8)
-#define ushort_xscan(s, u) ushort_scan_base(s, (u), 16)
-#define ushort0_xscan(s, u) ushort0_scan_base(s, (u), 16)
-#define ushort_bscan(s, u) ushort_scan_base(s, (u), 2)
-#define ushort0_bscan(s, u) ushort0_scan_base(s, (u), 2)
-
-#endif
diff --git a/src/headers/ushort-header b/src/headers/ushort-header
deleted file mode 100644
index 66b7f9a..0000000
--- a/src/headers/ushort-header
+++ /dev/null
@@ -1,5 +0,0 @@
-/* ISC license. */
-
-#ifndef USHORT_H
-#define USHORT_H
-