From 3534b428629be185e096be99e3bd5fdfe32d5544 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 18 Sep 2014 18:55:44 +0000 Subject: initial commit with rc for skalibs-2.0.0.0 --- src/headers/error-addrinuse | 3 +++ src/headers/error-already | 1 + src/headers/error-footer | 2 ++ src/headers/error-header | 12 ++++++++++++ src/headers/error-proto | 3 +++ src/headers/gidstuff-16 | 7 +++++++ src/headers/gidstuff-32 | 7 +++++++ src/headers/gidstuff-64 | 7 +++++++ src/headers/gidstuff-footer | 2 ++ src/headers/gidstuff-header | 5 +++++ src/headers/ip46-footer | 10 ++++++++++ src/headers/ip46-header | 34 ++++++++++++++++++++++++++++++++++ src/headers/ip46-with | 24 ++++++++++++++++++++++++ src/headers/ip46-without | 28 ++++++++++++++++++++++++++++ src/headers/setgroups-footer | 2 ++ src/headers/setgroups-header | 5 +++++ src/headers/setgroups-stub | 2 ++ src/headers/uint-16 | 34 ++++++++++++++++++++++++++++++++++ src/headers/uint-32 | 34 ++++++++++++++++++++++++++++++++++ src/headers/uint-64 | 34 ++++++++++++++++++++++++++++++++++ src/headers/uint-footer | 10 ++++++++++ src/headers/uint-header | 5 +++++ src/headers/uint16-bendian | 3 +++ src/headers/uint16-footer | 40 ++++++++++++++++++++++++++++++++++++++++ src/headers/uint16-header | 9 +++++++++ src/headers/uint16-lendian | 3 +++ src/headers/uint32-bendian | 3 +++ src/headers/uint32-footer | 39 +++++++++++++++++++++++++++++++++++++++ src/headers/uint32-header | 9 +++++++++ src/headers/uint32-inttypesh | 3 +++ src/headers/uint32-lendian | 3 +++ src/headers/uint32-noulong32 | 2 ++ src/headers/uint32-stdinth | 3 +++ src/headers/uint32-ulong32 | 2 ++ src/headers/uint64-bendian | 3 +++ src/headers/uint64-footer | 39 +++++++++++++++++++++++++++++++++++++++ src/headers/uint64-header | 5 +++++ src/headers/uint64-lendian | 3 +++ src/headers/uint64-noulong64 | 2 ++ src/headers/uint64-stdinth | 3 +++ src/headers/uint64-ulong64 | 1 + src/headers/ulong-32 | 32 ++++++++++++++++++++++++++++++++ src/headers/ulong-64 | 32 ++++++++++++++++++++++++++++++++ src/headers/ulong-footer | 10 ++++++++++ src/headers/ulong-header | 5 +++++ src/headers/ushort-16 | 34 ++++++++++++++++++++++++++++++++++ src/headers/ushort-32 | 34 ++++++++++++++++++++++++++++++++++ src/headers/ushort-footer | 10 ++++++++++ src/headers/ushort-header | 5 +++++ 49 files changed, 608 insertions(+) create mode 100644 src/headers/error-addrinuse create mode 100644 src/headers/error-already create mode 100644 src/headers/error-footer create mode 100644 src/headers/error-header create mode 100644 src/headers/error-proto create mode 100644 src/headers/gidstuff-16 create mode 100644 src/headers/gidstuff-32 create mode 100644 src/headers/gidstuff-64 create mode 100644 src/headers/gidstuff-footer create mode 100644 src/headers/gidstuff-header create mode 100644 src/headers/ip46-footer create mode 100644 src/headers/ip46-header create mode 100644 src/headers/ip46-with create mode 100644 src/headers/ip46-without create mode 100644 src/headers/setgroups-footer create mode 100644 src/headers/setgroups-header create mode 100644 src/headers/setgroups-stub create mode 100644 src/headers/uint-16 create mode 100644 src/headers/uint-32 create mode 100644 src/headers/uint-64 create mode 100644 src/headers/uint-footer create mode 100644 src/headers/uint-header create mode 100644 src/headers/uint16-bendian create mode 100644 src/headers/uint16-footer create mode 100644 src/headers/uint16-header create mode 100644 src/headers/uint16-lendian create mode 100644 src/headers/uint32-bendian create mode 100644 src/headers/uint32-footer create mode 100644 src/headers/uint32-header create mode 100644 src/headers/uint32-inttypesh create mode 100644 src/headers/uint32-lendian create mode 100644 src/headers/uint32-noulong32 create mode 100644 src/headers/uint32-stdinth create mode 100644 src/headers/uint32-ulong32 create mode 100644 src/headers/uint64-bendian create mode 100644 src/headers/uint64-footer create mode 100644 src/headers/uint64-header create mode 100644 src/headers/uint64-lendian create mode 100644 src/headers/uint64-noulong64 create mode 100644 src/headers/uint64-stdinth create mode 100644 src/headers/uint64-ulong64 create mode 100644 src/headers/ulong-32 create mode 100644 src/headers/ulong-64 create mode 100644 src/headers/ulong-footer create mode 100644 src/headers/ulong-header create mode 100644 src/headers/ushort-16 create mode 100644 src/headers/ushort-32 create mode 100644 src/headers/ushort-footer create mode 100644 src/headers/ushort-header (limited to 'src/headers') diff --git a/src/headers/error-addrinuse b/src/headers/error-addrinuse new file mode 100644 index 0000000..6f1e4fe --- /dev/null +++ b/src/headers/error-addrinuse @@ -0,0 +1,3 @@ + +/* BSD sucks */ +#define error_isalready(e) (((e) == EALREADY) || ((e) == EINPROGRESS) || ((e) == EADDRINUSE)) diff --git a/src/headers/error-already b/src/headers/error-already new file mode 100644 index 0000000..ac6b8a7 --- /dev/null +++ b/src/headers/error-already @@ -0,0 +1 @@ +#define error_isalready(e) (((e) == EALREADY) || ((e) == EINPROGRESS)) diff --git a/src/headers/error-footer b/src/headers/error-footer new file mode 100644 index 0000000..ddd5dae --- /dev/null +++ b/src/headers/error-footer @@ -0,0 +1,2 @@ + +#endif diff --git a/src/headers/error-header b/src/headers/error-header new file mode 100644 index 0000000..b891b6b --- /dev/null +++ b/src/headers/error-header @@ -0,0 +1,12 @@ +/* ISC license. */ + +#ifndef ERROR_H +#define ERROR_H + +#include +#include + +extern char const *error_str (int) gccattr_const ; +extern int error_temp (int) gccattr_const ; + +#define error_isagain(e) (((e) == EAGAIN) || ((e) == EWOULDBLOCK)) diff --git a/src/headers/error-proto b/src/headers/error-proto new file mode 100644 index 0000000..fd0c01d --- /dev/null +++ b/src/headers/error-proto @@ -0,0 +1,3 @@ + +/* Did I ever mention that BSD sucks ? */ +#define EPROTO EPROTOTYPE diff --git a/src/headers/gidstuff-16 b/src/headers/gidstuff-16 new file mode 100644 index 0000000..491de89 --- /dev/null +++ b/src/headers/gidstuff-16 @@ -0,0 +1,7 @@ +#include + +#define GID_FMT UINT16_FMT +#define gid_fmt(s, u) uint16_fmt(s, u) +#define gid_scan(s, u) uint16_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 new file mode 100644 index 0000000..a8ed0e8 --- /dev/null +++ b/src/headers/gidstuff-32 @@ -0,0 +1,7 @@ +#include + +#define GID_FMT UINT32_FMT +#define gid_fmt(s, u) uint32_fmt(s, u) +#define gid_scan(s, u) uint32_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 new file mode 100644 index 0000000..3d441e6 --- /dev/null +++ b/src/headers/gidstuff-64 @@ -0,0 +1,7 @@ +#include + +#define GID_FMT UINT64_FMT +#define gid_fmt(s, u) uint64_fmt(s, u) +#define gid_scan(s, u) uint64_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-footer b/src/headers/gidstuff-footer new file mode 100644 index 0000000..ddd5dae --- /dev/null +++ b/src/headers/gidstuff-footer @@ -0,0 +1,2 @@ + +#endif diff --git a/src/headers/gidstuff-header b/src/headers/gidstuff-header new file mode 100644 index 0000000..73bf86b --- /dev/null +++ b/src/headers/gidstuff-header @@ -0,0 +1,5 @@ +/* ISC license. */ + +#ifndef GIDSTUFF_H +#define GIDSTUFF_H + diff --git a/src/headers/ip46-footer b/src/headers/ip46-footer new file mode 100644 index 0000000..4340daf --- /dev/null +++ b/src/headers/ip46-footer @@ -0,0 +1,10 @@ + +#define ip46_from_ip(i, s, h) ((h) ? ip46_from_ip6(i, s) : ip46_from_ip4(i, s)) + +#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 *) ; +#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 new file mode 100644 index 0000000..4f0cf8c --- /dev/null +++ b/src/headers/ip46-header @@ -0,0 +1,34 @@ +/* ISC license. */ + +#ifndef IP46_H +#define IP46_H + +#include +#include +#include +#include +#include +#include + +#define IP46_FMT IP6_FMT +#define IP4_ANY "\0\0\0" +#define IP6_ANY "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define IP4_LOCAL "\177\0\0\1" +#define IP6_LOCAL "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1" + +typedef struct ip46full_s ip46full_t, *ip46full_t_ref ; + +struct ip46full_s +{ + char ip[16] ; + unsigned int is6: 1 ; +} ; +#define IP46FULL_ZERO { .ip = IP6_ANY, .is6 = 0 } + +#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_ref) ; +extern unsigned int ip46full_scanlist (ip46full_t_ref, unsigned int, char const *, unsigned int *) ; +#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 new file mode 100644 index 0000000..0cd3d19 --- /dev/null +++ b/src/headers/ip46-with @@ -0,0 +1,24 @@ +typedef ip46full_t ip46_t, *ip46_t_ref ; +#define IP46_ZERO IP46FULL_ZERO + +#define SKALIBS_IPV6_ENABLED +#define SKALIBS_IP_SIZE 16 +#define ip46_is6(i) ip46full_is6(i) +#define ip46_fmt(s, i) ip46full_fmt(s, i) +#define ip46_scan(s, i) ip46full_scan(s, i) +#define ip46_scanlist(out, max, s, num) ip46full_scanlist(out, max, s, num) +#define ip46_from_ip4(i, ip4) (ip46full_from_ip4(i, ip4), 1) +#define ip46_from_ip6(i, ip6) (ip46full_from_ip6(i, ip6), 1) + +#define socket_connect46(s, i, port) ((i)->is6 ? socket_connect6(s, (i)->ip, port) : socket_connect4(s, (i)->ip, port)) +#define socket_bind46(s, i, port) ((i)->is6 ? socket_bind6(s, (i)->ip, port) : socket_bind4(s, (i)->ip, port)) +#define socket_bind46_reuse(s, i, port) ((i)->is6 ? socket_bind6_reuse(s, (i)->ip, port) : socket_bind4_reuse(s, (i)->ip, port)) +#define socket_tcp46(h) ((h) ? socket_tcp6() : socket_tcp4()) +#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_ref, uint16 *) ; +extern int socket_remote46 (int, ip46_t_ref, uint16 *) ; + +#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/ip46-without b/src/headers/ip46-without new file mode 100644 index 0000000..7887482 --- /dev/null +++ b/src/headers/ip46-without @@ -0,0 +1,28 @@ +typedef struct ip46_s ip46_t, *ip46_t_ref ; +struct ip46_s +{ + char ip[4] ; +} ; +#define IP46_ZERO { .ip = "\0\0\0" } + +#undef SKALIBS_IPV6_ENABLED +#define SKALIBS_IP_SIZE 4 +#define ip46_is6(ip) 0 +#define ip46_fmt(s, i) ip4_fmt(s, (i)->ip) +#define ip46_scan(s, i) ip4_scan(s, (i)->ip) +#define ip46_scanlist(out, max, s, num) ip4_scanlist((out)->ip, max, s, num) +#define ip46_from_ip4(i, ip4) (byte_copy((i)->ip, 4, ip4), 1) +#define ip46_from_ip6(i, ip6) (errno = ENOSYS, 0) + +#define socket_connect46(s, i, port) socket_connect4(s, (i)->ip, port) +#define socket_bind46(s, i, port) socket_bind4(s, (i)->ip, port) +#define socket_bind46_reuse(s, i, port) socket_bind4_reuse(s, (i)->ip, port) +#define socket_tcp46(h) socket_tcp4() +#define socket_udp46(h) socket_udp4() +#define socket_recv46(fd, s, len, i, port) socket_recv4(fd, s, len, (i)->ip, port) +#define socket_send46(fd, s, len, i, port) socket_send4(fd, s, len, (i)->ip, port) +#define socket_local46(fd, i, port) socket_local4(fd, (i)->ip, port) +#define socket_remote46(fd, i, port) socket_remote4(fd, (i)->ip, port) + +#define socket_recvnb46(fd, buf, len, i, port, deadline, stamp) socket_recvnb4(fd, buf, len, (i)->ip, port, deadline, stamp) +#define socket_sendnb46(fd, buf, len, i, port, deadline, stamp) socket_sendnb4(fd, buf, len, (i)->ip, port, deadline, stamp) diff --git a/src/headers/setgroups-footer b/src/headers/setgroups-footer new file mode 100644 index 0000000..ddd5dae --- /dev/null +++ b/src/headers/setgroups-footer @@ -0,0 +1,2 @@ + +#endif diff --git a/src/headers/setgroups-header b/src/headers/setgroups-header new file mode 100644 index 0000000..0b8697a --- /dev/null +++ b/src/headers/setgroups-header @@ -0,0 +1,5 @@ +/* ISC license. */ + +#ifndef SETGROUPS_H +#define SETGROUPS_H + diff --git a/src/headers/setgroups-stub b/src/headers/setgroups-stub new file mode 100644 index 0000000..3c54861 --- /dev/null +++ b/src/headers/setgroups-stub @@ -0,0 +1,2 @@ +#include +#define setgroups(n, s) (errno = ENOSYS, -1) diff --git a/src/headers/uint-16 b/src/headers/uint-16 new file mode 100644 index 0000000..85434db --- /dev/null +++ b/src/headers/uint-16 @@ -0,0 +1,34 @@ +#include + +#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 new file mode 100644 index 0000000..32c6600 --- /dev/null +++ b/src/headers/uint-32 @@ -0,0 +1,34 @@ +#include + +#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 new file mode 100644 index 0000000..31926d9 --- /dev/null +++ b/src/headers/uint-64 @@ -0,0 +1,34 @@ +#include + +#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 new file mode 100644 index 0000000..68bbaf7 --- /dev/null +++ b/src/headers/uint-footer @@ -0,0 +1,10 @@ +#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 new file mode 100644 index 0000000..8136b0c --- /dev/null +++ b/src/headers/uint-header @@ -0,0 +1,5 @@ +/* ISC license. */ + +#ifndef UINT_H +#define UINT_H + diff --git a/src/headers/uint16-bendian b/src/headers/uint16-bendian new file mode 100644 index 0000000..e1d0427 --- /dev/null +++ b/src/headers/uint16-bendian @@ -0,0 +1,3 @@ +#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 new file mode 100644 index 0000000..5602571 --- /dev/null +++ b/src/headers/uint16-footer @@ -0,0 +1,40 @@ + +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 new file mode 100644 index 0000000..a8058c6 --- /dev/null +++ b/src/headers/uint16-header @@ -0,0 +1,9 @@ +/* ISC license. */ + +#ifndef UINT16_H +#define UINT16_H + +#include +#include + +typedef uint16_t uint16 ; diff --git a/src/headers/uint16-lendian b/src/headers/uint16-lendian new file mode 100644 index 0000000..a9f9945 --- /dev/null +++ b/src/headers/uint16-lendian @@ -0,0 +1,3 @@ +#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 new file mode 100644 index 0000000..27903c7 --- /dev/null +++ b/src/headers/uint32-bendian @@ -0,0 +1,3 @@ +#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 new file mode 100644 index 0000000..7cfe7ba --- /dev/null +++ b/src/headers/uint32-footer @@ -0,0 +1,39 @@ +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 new file mode 100644 index 0000000..f71267f --- /dev/null +++ b/src/headers/uint32-header @@ -0,0 +1,9 @@ +/* ISC license. */ + +#ifndef UINT32_H +#define UINT32_H + +#include +#include + +typedef uint32_t uint32 ; diff --git a/src/headers/uint32-inttypesh b/src/headers/uint32-inttypesh new file mode 100644 index 0000000..47a8910 --- /dev/null +++ b/src/headers/uint32-inttypesh @@ -0,0 +1,3 @@ +#include +typedef uint32_t uint32 ; + diff --git a/src/headers/uint32-lendian b/src/headers/uint32-lendian new file mode 100644 index 0000000..f88c111 --- /dev/null +++ b/src/headers/uint32-lendian @@ -0,0 +1,3 @@ +#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 new file mode 100644 index 0000000..4705047 --- /dev/null +++ b/src/headers/uint32-noulong32 @@ -0,0 +1,2 @@ +typedef unsigned int uint32 ; + diff --git a/src/headers/uint32-stdinth b/src/headers/uint32-stdinth new file mode 100644 index 0000000..dc9eb42 --- /dev/null +++ b/src/headers/uint32-stdinth @@ -0,0 +1,3 @@ +#include +typedef uint32_t uint32 ; + diff --git a/src/headers/uint32-ulong32 b/src/headers/uint32-ulong32 new file mode 100644 index 0000000..87119a5 --- /dev/null +++ b/src/headers/uint32-ulong32 @@ -0,0 +1,2 @@ +typedef unsigned long uint32 ; + diff --git a/src/headers/uint64-bendian b/src/headers/uint64-bendian new file mode 100644 index 0000000..2485bec --- /dev/null +++ b/src/headers/uint64-bendian @@ -0,0 +1,3 @@ +#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 new file mode 100644 index 0000000..df620a5 --- /dev/null +++ b/src/headers/uint64-footer @@ -0,0 +1,39 @@ +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 new file mode 100644 index 0000000..f0f10e6 --- /dev/null +++ b/src/headers/uint64-header @@ -0,0 +1,5 @@ +/* ISC license. */ + +#ifndef UINT64_H +#define UINT64_H + diff --git a/src/headers/uint64-lendian b/src/headers/uint64-lendian new file mode 100644 index 0000000..ffdb4de --- /dev/null +++ b/src/headers/uint64-lendian @@ -0,0 +1,3 @@ +#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 new file mode 100644 index 0000000..c72ebef --- /dev/null +++ b/src/headers/uint64-noulong64 @@ -0,0 +1,2 @@ +typedef unsigned long long uint64 ; + diff --git a/src/headers/uint64-stdinth b/src/headers/uint64-stdinth new file mode 100644 index 0000000..9c43f44 --- /dev/null +++ b/src/headers/uint64-stdinth @@ -0,0 +1,3 @@ +#include + +typedef uint64_t uint64 ; diff --git a/src/headers/uint64-ulong64 b/src/headers/uint64-ulong64 new file mode 100644 index 0000000..d9313d4 --- /dev/null +++ b/src/headers/uint64-ulong64 @@ -0,0 +1 @@ +typedef unsigned long uint64 ; diff --git a/src/headers/ulong-32 b/src/headers/ulong-32 new file mode 100644 index 0000000..b1b3326 --- /dev/null +++ b/src/headers/ulong-32 @@ -0,0 +1,32 @@ +#include + +#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 new file mode 100644 index 0000000..016fd1f --- /dev/null +++ b/src/headers/ulong-64 @@ -0,0 +1,32 @@ +#include + +#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 new file mode 100644 index 0000000..0607872 --- /dev/null +++ b/src/headers/ulong-footer @@ -0,0 +1,10 @@ +#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 new file mode 100644 index 0000000..98e6f37 --- /dev/null +++ b/src/headers/ulong-header @@ -0,0 +1,5 @@ +/* ISC license. */ + +#ifndef ULONG_H +#define ULONG_H + diff --git a/src/headers/ushort-16 b/src/headers/ushort-16 new file mode 100644 index 0000000..0e210c6 --- /dev/null +++ b/src/headers/ushort-16 @@ -0,0 +1,34 @@ +#include + +#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 new file mode 100644 index 0000000..b41aef4 --- /dev/null +++ b/src/headers/ushort-32 @@ -0,0 +1,34 @@ +#include + +#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 new file mode 100644 index 0000000..db56f73 --- /dev/null +++ b/src/headers/ushort-footer @@ -0,0 +1,10 @@ +#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 new file mode 100644 index 0000000..66b7f9a --- /dev/null +++ b/src/headers/ushort-header @@ -0,0 +1,5 @@ +/* ISC license. */ + +#ifndef USHORT_H +#define USHORT_H + -- cgit v1.2.3