diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index e667e09..fc49161 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -17,288 +17,6 @@
#include "../libtommath/tommath.h"
#include "c3.h"
-#define DEF_BUF_PARSE_S(BITS, bits) \
- sw buf_parse_s ## bits (s_buf *buf, s ## bits *dest) \
- { \
- s_buf_save digits; \
- e_bool negative = false; \
- sw r; \
- sw r1; \
- sw result = 0; \
- s_buf_save save; \
- s ## bits tmp; \
- s ## bits tmp1; \
- buf_save_init(buf, &save); \
- if ((r = buf_read_1(buf, "-")) < 0) \
- goto clean; \
- if (r > 0) { \
- result += r; \
- negative = true; \
- } \
- if ((r = buf_read_1(buf, "0b")) < 0) \
- goto restore; \
- if (r > 0) { \
- result += r; \
- if ((r = buf_parse_s ## bits ## _base(buf, &g_c3_base_binary, \
- negative, dest)) <= 0) \
- goto restore; \
- result += r; \
- goto ok; \
- } \
- if ((r = buf_read_1(buf, "0o")) < 0) \
- goto restore; \
- if (r > 0) { \
- result += r; \
- if ((r = buf_parse_s ## bits ## _base(buf, &g_c3_base_octal, \
- negative, dest)) <= 0) \
- goto restore; \
- result += r; \
- goto ok; \
- } \
- if ((r = buf_read_1(buf, "0x")) < 0) \
- goto restore; \
- if (r > 0) { \
- result += r; \
- buf_save_init(buf, &digits); \
- if ((r = buf_parse_s ## bits ## _base(buf, \
- g_c3_bases_hexadecimal, \
- negative, &tmp)) < 0) { \
- buf_save_clean(buf, &digits); \
- goto restore; \
- } \
- buf_save_restore_rpos(buf, &digits); \
- buf_save_clean(buf, &digits); \
- if ((r1 = buf_parse_s ## bits ## _base(buf, \
- g_c3_bases_hexadecimal + \
- 1, \
- negative, &tmp1)) < 0) { \
- r = r1; \
- goto restore; \
- } \
- if (r == 0 && r1 == 0) { \
- if (negative) \
- warnx("invalid number: -0x"); \
- else \
- warnx("invalid number: 0x"); \
- goto restore; \
- } \
- if (r > r1) { \
- result += r; \
- *dest = tmp; \
- } \
- else { \
- result += r1; \
- *dest = tmp1; \
- } \
- goto ok; \
- } \
- if ((r = buf_parse_s ## bits ## _base(buf, &g_c3_base_decimal, \
- negative, dest)) <= 0) \
- goto restore; \
- result += r; \
- ok: \
- r = result; \
- goto clean; \
- restore: \
- buf_save_restore_rpos(buf, &save); \
- clean: \
- buf_save_clean(buf, &save); \
- return r; \
- } \
- \
- sw buf_parse_s ## bits ## _base (s_buf *buf, const s_str *base, \
- bool negative, s ## bits *dest) \
- { \
- u8 digit; \
- sw r; \
- sw radix; \
- sw result = 0; \
- s_buf_save save; \
- u ## bits u = 0; \
- assert(buf); \
- assert(base); \
- assert(dest); \
- buf_save_init(buf, &save); \
- radix = str_length_utf8(base); \
- if (radix < 2 || radix > S ## BITS ## _MAX) { \
- buf_save_clean(buf, &save); \
- assert(! "buf_parse_s" # bits "_base: invalid radix"); \
- errx(1, "buf_parse_s" # bits "_base: invalid radix: %ld", \
- radix); \
- return -1; \
- } \
- while ((r = buf_parse_digit(buf, base, &digit)) > 0) { \
- result += r; \
- if (digit >= radix) { \
- buf_save_clean(buf, &save); \
- assert(! "buf_parse_s" # bits \
- "_base: digit greater than or equal to radix"); \
- errx(1, "buf_parse_s" # bits \
- "_base: digit greater than or equal to radix: %u", \
- digit); \
- return -1; \
- } \
- if (u > (u ## bits) ceiling_s ## bits (S ## BITS ## _MAX, \
- radix)) { \
- warnx("buf_parse_s" # bits "_base: *: integer overflow"); \
- r = -1; \
- goto restore; \
- } \
- u *= radix; \
- if (negative ? u > (u ## bits) -S ## BITS ## _MIN - digit : \
- u > (u ## bits) (S ## BITS ## _MAX - digit)) { \
- warnx("buf_parse_s" # bits "_base: +: integer overflow"); \
- r = -1; \
- goto restore; \
- } \
- u += digit; \
- } \
- *dest = negative ? -u : u; \
- r = result; \
- goto clean; \
- restore: \
- buf_save_restore_rpos(buf, &save); \
- clean: \
- buf_save_clean(buf, &save); \
- return r; \
- }
-
-#define DEF_BUF_PARSE_U(BITS, bits) \
- sw buf_parse_u ## bits (s_buf *buf, u ## bits *dest) \
- { \
- s_buf_save digits; \
- sw r; \
- sw r1; \
- sw result = 0; \
- s_buf_save save; \
- u ## bits tmp; \
- u ## bits tmp1; \
- buf_save_init(buf, &save); \
- if ((r = buf_read_1(buf, "0b")) < 0) \
- goto restore; \
- if (r > 0) { \
- result += r; \
- if ((r = buf_parse_u ## bits ## _base(buf, &g_c3_base_binary, \
- dest)) <= 0) \
- goto restore; \
- result += r; \
- goto ok; \
- } \
- if ((r = buf_read_1(buf, "0o")) < 0) \
- goto restore; \
- if (r > 0) { \
- result += r; \
- if ((r = buf_parse_u ## bits ## _base(buf, &g_c3_base_octal, \
- dest)) <= 0) \
- goto restore; \
- result += r; \
- goto ok; \
- } \
- if ((r = buf_read_1(buf, "0x")) < 0) \
- goto restore; \
- if (r > 0) { \
- result += r; \
- buf_save_init(buf, &digits); \
- if ((r = buf_parse_u ## bits ## _base(buf, \
- g_c3_bases_hexadecimal, \
- &tmp)) < 0) { \
- buf_save_clean(buf, &digits); \
- goto restore; \
- } \
- buf_save_restore_rpos(buf, &digits); \
- buf_save_clean(buf, &digits); \
- if ((r1 = buf_parse_u ## bits ## _base(buf, \
- g_c3_bases_hexadecimal + \
- 1, &tmp1)) < 0) { \
- r = r1; \
- goto restore; \
- } \
- if (r == 0 && r1 == 0) { \
- warnx("invalid number: 0x"); \
- goto restore; \
- } \
- if (r > r1) { \
- result += r; \
- *dest = tmp; \
- } \
- else { \
- result += r1; \
- *dest = tmp1; \
- } \
- goto ok; \
- } \
- if ((r = buf_parse_u ## bits ## _base(buf, &g_c3_base_decimal, \
- dest)) <= 0) \
- goto restore; \
- result += r; \
- ok: \
- r = result; \
- goto clean; \
- restore: \
- buf_save_restore_rpos(buf, &save); \
- clean: \
- buf_save_clean(buf, &save); \
- return r; \
- } \
- \
- sw buf_parse_u ## bits ## _base (s_buf *buf, const s_str *base, \
- u ## bits *dest) \
- { \
- u8 digit; \
- sw r; \
- sw radix; \
- sw result = 0; \
- s_buf_save save; \
- u ## bits u = 0; \
- assert(buf); \
- assert(base); \
- assert(dest); \
- buf_save_init(buf, &save); \
- radix = str_length_utf8(base); \
- if (radix < 2 || (uw) radix > U ## BITS ## _MAX) { \
- buf_save_clean(buf, &save); \
- assert(! "buf_parse_u" # bits "_base: invalid radix"); \
- errx(1, "buf_parse_u" # bits "_base: invalid radix: %ld", \
- radix); \
- return -1; \
- } \
- while ((r = buf_parse_digit(buf, base, &digit)) > 0) { \
- result += r; \
- if (digit >= radix) { \
- buf_save_clean(buf, &save); \
- assert(! "buf_parse_u" # bits \
- "_base: digit greater than or equal to radix"); \
- errx(1, "buf_parse_u" # bits \
- "_base: digit greater than or equal to radix: %u", \
- digit); \
- return -1; \
- } \
- if (u > ceiling_u ## bits (U ## BITS ## _MAX, radix)) { \
- warnx("buf_parse_u" # bits \
- "_base: %llu * %llu: integer overflow", \
- (unsigned long long) u, \
- (unsigned long long) radix); \
- r = -1; \
- goto restore; \
- } \
- u *= radix; \
- if (u > (u ## bits) (U ## BITS ## _MAX - digit)) { \
- warnx("buf_parse_u" # bits "_base: +: integer overflow"); \
- r = -1; \
- goto restore; \
- } \
- u += digit; \
- } \
- *dest = u; \
- r = result; \
- goto clean; \
- restore: \
- buf_save_restore_rpos(buf, &save); \
- clean: \
- buf_save_clean(buf, &save); \
- return r; \
- }
-
sw buf_parse_cfn_arg_types (s_buf *buf, s_list **dest);
sw buf_parse_array_type (s_buf *buf, e_tag_type *dest)
@@ -1846,12 +1564,6 @@ sw buf_parse_quote (s_buf *buf, s_quote *dest)
return r;
}
-DEF_BUF_PARSE_S(8, 8)
-DEF_BUF_PARSE_S(16, 16)
-DEF_BUF_PARSE_S(32, 32)
-DEF_BUF_PARSE_S(64, 64)
-DEF_BUF_PARSE_S(W, w)
-
sw buf_parse_str (s_buf *buf, s_str *dest)
{
u8 b;
@@ -2422,12 +2134,6 @@ sw buf_parse_tuple (s_buf *buf, s_tuple *tuple)
return r;
}
-DEF_BUF_PARSE_U(8, 8)
-DEF_BUF_PARSE_U(16, 16)
-DEF_BUF_PARSE_U(32, 32)
-DEF_BUF_PARSE_U(64, 64)
-DEF_BUF_PARSE_U(W, w)
-
sw buf_parse_u64_dec (s_buf *buf, u64 *dest)
{
sw r;
diff --git a/libc3/buf_parse.h b/libc3/buf_parse.h
index 0f302f9..44515e2 100644
--- a/libc3/buf_parse.h
+++ b/libc3/buf_parse.h
@@ -19,7 +19,16 @@
#ifndef BUF_PARSE_H
#define BUF_PARSE_H
-#include "types.h"
+#include "buf_parse_s8.h"
+#include "buf_parse_s16.h"
+#include "buf_parse_s32.h"
+#include "buf_parse_s64.h"
+#include "buf_parse_sw.h"
+#include "buf_parse_u8.h"
+#include "buf_parse_u16.h"
+#include "buf_parse_u32.h"
+#include "buf_parse_u64.h"
+#include "buf_parse_uw.h"
/**
* # buf_parse_
@@ -30,16 +39,6 @@
* dest is untouched.
*/
-#define BUF_PARSE_S_PROTOTYPES(bits) \
- sw buf_parse_s ## bits (s_buf *buf, s ## bits *dest); \
- sw buf_parse_s ## bits ## _base (s_buf *buf, const s_str *base, \
- bool negative, s ## bits *dest)
-
-#define BUF_PARSE_U_PROTOTYPES(bits) \
- sw buf_parse_u ## bits (s_buf *buf, u ## bits *dest); \
- sw buf_parse_u ## bits ## _base (s_buf *buf, const s_str *base, \
- u ## bits *dest)
-
sw buf_parse_array (s_buf *buf, s_array *dest);
sw buf_parse_array_type (s_buf *buf, e_tag_type *type);
sw buf_parse_bool (s_buf *buf, bool *dest);
@@ -75,11 +74,6 @@ sw buf_parse_module_name (s_buf *buf, const s_sym **dest);
sw buf_parse_new_tag (s_buf *buf, s_tag **dest);
sw buf_parse_ptag (s_buf *buf, p_tag *dest);
sw buf_parse_quote (s_buf *buf, s_quote *dest);
-BUF_PARSE_S_PROTOTYPES(8);
-BUF_PARSE_S_PROTOTYPES(16);
-BUF_PARSE_S_PROTOTYPES(32);
-BUF_PARSE_S_PROTOTYPES(64);
-BUF_PARSE_S_PROTOTYPES(w);
sw buf_parse_str (s_buf *buf, s_str *dest);
sw buf_parse_str_character (s_buf *buf, character *dest);
sw buf_parse_str_character_unicode (s_buf *buf, character *dest);
@@ -104,12 +98,7 @@ sw buf_parse_tag_str_u8 (s_buf *buf, s_tag *dest);
sw buf_parse_tag_sym (s_buf *buf, s_tag *dest);
sw buf_parse_tag_tuple (s_buf *buf, s_tag *dest);
sw buf_parse_tuple (s_buf *buf, s_tuple *dest);
-BUF_PARSE_U_PROTOTYPES(8);
-BUF_PARSE_U_PROTOTYPES(16);
-BUF_PARSE_U_PROTOTYPES(32);
-BUF_PARSE_U_PROTOTYPES(64);
sw buf_parse_u64_hex (s_buf *buf, u64 *dest);
-BUF_PARSE_U_PROTOTYPES(w);
sw buf_parse_var (s_buf *buf, void *dest);
sw buf_parse_void (s_buf *buf, void *dest);
diff --git a/libc3/buf_parse_s.c.in b/libc3/buf_parse_s.c.in
new file mode 100644
index 0000000..471a0f6
--- /dev/null
+++ b/libc3/buf_parse_s.c.in
@@ -0,0 +1,157 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.c.in BITS=_BITS$ bits=_bits$ */
+
+#include "c3.h"
+
+sw buf_parse_s_bits$ (s_buf *buf, s_bits$ *dest)
+{
+ s_buf_save digits;
+ e_bool negative = false;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ s_bits$ tmp;
+ s_bits$ tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "-")) < 0)
+ goto clean;
+ if (r > 0) {
+ result += r;
+ negative = true;
+ }
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_s_bits$_base(buf, &g_c3_base_binary,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_s_bits$_base(buf, &g_c3_base_octal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_s_bits$_base(buf,
+ g_c3_bases_hexadecimal,
+ negative, &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_s_bits$_base(buf, g_c3_bases_hexadecimal + 1,
+ negative, &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ if (negative)
+ warnx("invalid number: -0x");
+ else
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_s_bits$_base(buf, &g_c3_base_decimal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_s_bits$_base (s_buf *buf, const s_str *base,
+ bool negative, s_bits$ *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ u_bits$ u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || radix > S_BITS$_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_s_bits$_base: invalid radix");
+ errx(1, "buf_parse_s_bits$_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_s_bits$_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_s_bits$_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > (u_bits$) ceiling_s_bits$ (S_BITS$_MAX, radix)) {
+ warnx("buf_parse_s_bits$_base: *: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (negative ? u > (u_bits$) -S_BITS$_MIN - digit :
+ u > (u_bits$) (S_BITS$_MAX - digit)) {
+ warnx("buf_parse_s_bits$_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = negative ? -u : u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_s.h.in b/libc3/buf_parse_s.h.in
new file mode 100644
index 0000000..0a5da26
--- /dev/null
+++ b/libc3/buf_parse_s.h.in
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.h.in BITS=_BITS$ bits=_bits$ */
+#ifndef BUF_PARSE_S_BITS$_H
+#define BUF_PARSE_S_BITS$_H
+
+#include "types.h"
+
+sw buf_parse_s_bits$ (s_buf *buf, s_bits$ *dest);
+sw buf_parse_s_bits$_base (s_buf *buf, const s_str *base,
+ bool negative, s_bits$ *dest);
+
+#endif /* #ifndef BUF_PARSE_S_BITS$_H */
diff --git a/libc3/buf_parse_s16.c b/libc3/buf_parse_s16.c
new file mode 100644
index 0000000..c9d9137
--- /dev/null
+++ b/libc3/buf_parse_s16.c
@@ -0,0 +1,157 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.c.in BITS=16 bits=16 */
+
+#include "c3.h"
+
+sw buf_parse_s16 (s_buf *buf, s16 *dest)
+{
+ s_buf_save digits;
+ e_bool negative = false;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ s16 tmp;
+ s16 tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "-")) < 0)
+ goto clean;
+ if (r > 0) {
+ result += r;
+ negative = true;
+ }
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_s16_base(buf, &g_c3_base_binary,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_s16_base(buf, &g_c3_base_octal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_s16_base(buf,
+ g_c3_bases_hexadecimal,
+ negative, &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_s16_base(buf, g_c3_bases_hexadecimal + 1,
+ negative, &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ if (negative)
+ warnx("invalid number: -0x");
+ else
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_s16_base(buf, &g_c3_base_decimal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_s16_base (s_buf *buf, const s_str *base,
+ bool negative, s16 *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ u16 u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || radix > S16_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_s16_base: invalid radix");
+ errx(1, "buf_parse_s16_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_s16_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_s16_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > (u16) ceiling_s16 (S16_MAX, radix)) {
+ warnx("buf_parse_s16_base: *: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (negative ? u > (u16) -S16_MIN - digit :
+ u > (u16) (S16_MAX - digit)) {
+ warnx("buf_parse_s16_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = negative ? -u : u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_s16.h b/libc3/buf_parse_s16.h
new file mode 100644
index 0000000..cd00e3b
--- /dev/null
+++ b/libc3/buf_parse_s16.h
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.h.in BITS=16 bits=16 */
+#ifndef BUF_PARSE_S16_H
+#define BUF_PARSE_S16_H
+
+#include "types.h"
+
+sw buf_parse_s16 (s_buf *buf, s16 *dest);
+sw buf_parse_s16_base (s_buf *buf, const s_str *base,
+ bool negative, s16 *dest);
+
+#endif /* #ifndef BUF_PARSE_S16_H */
diff --git a/libc3/buf_parse_s32.c b/libc3/buf_parse_s32.c
new file mode 100644
index 0000000..a937894
--- /dev/null
+++ b/libc3/buf_parse_s32.c
@@ -0,0 +1,157 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.c.in BITS=32 bits=32 */
+
+#include "c3.h"
+
+sw buf_parse_s32 (s_buf *buf, s32 *dest)
+{
+ s_buf_save digits;
+ e_bool negative = false;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ s32 tmp;
+ s32 tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "-")) < 0)
+ goto clean;
+ if (r > 0) {
+ result += r;
+ negative = true;
+ }
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_s32_base(buf, &g_c3_base_binary,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_s32_base(buf, &g_c3_base_octal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_s32_base(buf,
+ g_c3_bases_hexadecimal,
+ negative, &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_s32_base(buf, g_c3_bases_hexadecimal + 1,
+ negative, &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ if (negative)
+ warnx("invalid number: -0x");
+ else
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_s32_base(buf, &g_c3_base_decimal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_s32_base (s_buf *buf, const s_str *base,
+ bool negative, s32 *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ u32 u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || radix > S32_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_s32_base: invalid radix");
+ errx(1, "buf_parse_s32_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_s32_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_s32_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > (u32) ceiling_s32 (S32_MAX, radix)) {
+ warnx("buf_parse_s32_base: *: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (negative ? u > (u32) -S32_MIN - digit :
+ u > (u32) (S32_MAX - digit)) {
+ warnx("buf_parse_s32_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = negative ? -u : u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_s32.h b/libc3/buf_parse_s32.h
new file mode 100644
index 0000000..2efc89b
--- /dev/null
+++ b/libc3/buf_parse_s32.h
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.h.in BITS=32 bits=32 */
+#ifndef BUF_PARSE_S32_H
+#define BUF_PARSE_S32_H
+
+#include "types.h"
+
+sw buf_parse_s32 (s_buf *buf, s32 *dest);
+sw buf_parse_s32_base (s_buf *buf, const s_str *base,
+ bool negative, s32 *dest);
+
+#endif /* #ifndef BUF_PARSE_S32_H */
diff --git a/libc3/buf_parse_s64.c b/libc3/buf_parse_s64.c
new file mode 100644
index 0000000..6f3d1d5
--- /dev/null
+++ b/libc3/buf_parse_s64.c
@@ -0,0 +1,157 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.c.in BITS=64 bits=64 */
+
+#include "c3.h"
+
+sw buf_parse_s64 (s_buf *buf, s64 *dest)
+{
+ s_buf_save digits;
+ e_bool negative = false;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ s64 tmp;
+ s64 tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "-")) < 0)
+ goto clean;
+ if (r > 0) {
+ result += r;
+ negative = true;
+ }
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_s64_base(buf, &g_c3_base_binary,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_s64_base(buf, &g_c3_base_octal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_s64_base(buf,
+ g_c3_bases_hexadecimal,
+ negative, &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_s64_base(buf, g_c3_bases_hexadecimal + 1,
+ negative, &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ if (negative)
+ warnx("invalid number: -0x");
+ else
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_s64_base(buf, &g_c3_base_decimal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_s64_base (s_buf *buf, const s_str *base,
+ bool negative, s64 *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ u64 u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || radix > S64_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_s64_base: invalid radix");
+ errx(1, "buf_parse_s64_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_s64_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_s64_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > (u64) ceiling_s64 (S64_MAX, radix)) {
+ warnx("buf_parse_s64_base: *: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (negative ? u > (u64) -S64_MIN - digit :
+ u > (u64) (S64_MAX - digit)) {
+ warnx("buf_parse_s64_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = negative ? -u : u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_s64.h b/libc3/buf_parse_s64.h
new file mode 100644
index 0000000..fc5e3b7
--- /dev/null
+++ b/libc3/buf_parse_s64.h
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.h.in BITS=64 bits=64 */
+#ifndef BUF_PARSE_S64_H
+#define BUF_PARSE_S64_H
+
+#include "types.h"
+
+sw buf_parse_s64 (s_buf *buf, s64 *dest);
+sw buf_parse_s64_base (s_buf *buf, const s_str *base,
+ bool negative, s64 *dest);
+
+#endif /* #ifndef BUF_PARSE_S64_H */
diff --git a/libc3/buf_parse_s8.c b/libc3/buf_parse_s8.c
new file mode 100644
index 0000000..cafccd6
--- /dev/null
+++ b/libc3/buf_parse_s8.c
@@ -0,0 +1,157 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.c.in BITS=8 bits=8 */
+
+#include "c3.h"
+
+sw buf_parse_s8 (s_buf *buf, s8 *dest)
+{
+ s_buf_save digits;
+ e_bool negative = false;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ s8 tmp;
+ s8 tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "-")) < 0)
+ goto clean;
+ if (r > 0) {
+ result += r;
+ negative = true;
+ }
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_s8_base(buf, &g_c3_base_binary,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_s8_base(buf, &g_c3_base_octal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_s8_base(buf,
+ g_c3_bases_hexadecimal,
+ negative, &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_s8_base(buf, g_c3_bases_hexadecimal + 1,
+ negative, &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ if (negative)
+ warnx("invalid number: -0x");
+ else
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_s8_base(buf, &g_c3_base_decimal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_s8_base (s_buf *buf, const s_str *base,
+ bool negative, s8 *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ u8 u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || radix > S8_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_s8_base: invalid radix");
+ errx(1, "buf_parse_s8_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_s8_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_s8_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > (u8) ceiling_s8 (S8_MAX, radix)) {
+ warnx("buf_parse_s8_base: *: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (negative ? u > (u8) -S8_MIN - digit :
+ u > (u8) (S8_MAX - digit)) {
+ warnx("buf_parse_s8_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = negative ? -u : u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_s8.h b/libc3/buf_parse_s8.h
new file mode 100644
index 0000000..51c065c
--- /dev/null
+++ b/libc3/buf_parse_s8.h
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.h.in BITS=8 bits=8 */
+#ifndef BUF_PARSE_S8_H
+#define BUF_PARSE_S8_H
+
+#include "types.h"
+
+sw buf_parse_s8 (s_buf *buf, s8 *dest);
+sw buf_parse_s8_base (s_buf *buf, const s_str *base,
+ bool negative, s8 *dest);
+
+#endif /* #ifndef BUF_PARSE_S8_H */
diff --git a/libc3/buf_parse_sw.c b/libc3/buf_parse_sw.c
new file mode 100644
index 0000000..ceec7b9
--- /dev/null
+++ b/libc3/buf_parse_sw.c
@@ -0,0 +1,157 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.c.in BITS=W bits=w */
+
+#include "c3.h"
+
+sw buf_parse_sw (s_buf *buf, sw *dest)
+{
+ s_buf_save digits;
+ e_bool negative = false;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ sw tmp;
+ sw tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "-")) < 0)
+ goto clean;
+ if (r > 0) {
+ result += r;
+ negative = true;
+ }
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_sw_base(buf, &g_c3_base_binary,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_sw_base(buf, &g_c3_base_octal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_sw_base(buf,
+ g_c3_bases_hexadecimal,
+ negative, &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_sw_base(buf, g_c3_bases_hexadecimal + 1,
+ negative, &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ if (negative)
+ warnx("invalid number: -0x");
+ else
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_sw_base(buf, &g_c3_base_decimal,
+ negative, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_sw_base (s_buf *buf, const s_str *base,
+ bool negative, sw *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ uw u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || radix > SW_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_sw_base: invalid radix");
+ errx(1, "buf_parse_sw_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_sw_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_sw_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > (uw) ceiling_sw (SW_MAX, radix)) {
+ warnx("buf_parse_sw_base: *: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (negative ? u > (uw) -SW_MIN - digit :
+ u > (uw) (SW_MAX - digit)) {
+ warnx("buf_parse_sw_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = negative ? -u : u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_sw.h b/libc3/buf_parse_sw.h
new file mode 100644
index 0000000..dc9be4e
--- /dev/null
+++ b/libc3/buf_parse_sw.h
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_s.h.in BITS=W bits=w */
+#ifndef BUF_PARSE_SW_H
+#define BUF_PARSE_SW_H
+
+#include "types.h"
+
+sw buf_parse_sw (s_buf *buf, sw *dest);
+sw buf_parse_sw_base (s_buf *buf, const s_str *base,
+ bool negative, sw *dest);
+
+#endif /* #ifndef BUF_PARSE_SW_H */
diff --git a/libc3/buf_parse_u.c.in b/libc3/buf_parse_u.c.in
new file mode 100644
index 0000000..16edcc8
--- /dev/null
+++ b/libc3/buf_parse_u.c.in
@@ -0,0 +1,144 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.c.in BITS=_BITS$ bits=_bits$ */
+
+#include "c3.h"
+
+sw buf_parse_u_bits$ (s_buf *buf, u_bits$ *dest)
+{
+ s_buf_save digits;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ u_bits$ tmp;
+ u_bits$ tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_u_bits$_base(buf, &g_c3_base_binary, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_u_bits$_base(buf, &g_c3_base_octal, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_u_bits$_base(buf, g_c3_bases_hexadecimal,
+ &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_u_bits$_base(buf, g_c3_bases_hexadecimal + 1,
+ &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_u_bits$_base(buf, &g_c3_base_decimal, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_u_bits$_base (s_buf *buf, const s_str *base,
+ u_bits$ *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ u_bits$ u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || (uw) radix > U_BITS$_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_u_bits$_base: invalid radix");
+ errx(1, "buf_parse_u_bits$_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_u_bits$_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_u_bits$_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > ceiling_u_bits$(U_BITS$_MAX, radix)) {
+ warnx("buf_parse_u_bits$_base: %llu * %llu: integer overflow",
+ (unsigned long long) u,
+ (unsigned long long) radix);
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (u > (u_bits$) (U_BITS$_MAX - digit)) {
+ warnx("buf_parse_u_bits$_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_u.h.in b/libc3/buf_parse_u.h.in
new file mode 100644
index 0000000..f3b131b
--- /dev/null
+++ b/libc3/buf_parse_u.h.in
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.h.in BITS=_BITS$ bits=_bits$ */
+#ifndef BUF_PARSE_U_BITS$_H
+#define BUF_PARSE_U_BITS$_H
+
+#include "types.h"
+
+sw buf_parse_u_bits$ (s_buf *buf, u_bits$ *dest);
+sw buf_parse_u_bits$_base (s_buf *buf, const s_str *base,
+ u_bits$ *dest);
+
+#endif /* #ifndef BUF_PARSE_U_BITS$_H */
diff --git a/libc3/buf_parse_u16.c b/libc3/buf_parse_u16.c
new file mode 100644
index 0000000..e9656ed
--- /dev/null
+++ b/libc3/buf_parse_u16.c
@@ -0,0 +1,144 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.c.in BITS=16 bits=16 */
+
+#include "c3.h"
+
+sw buf_parse_u16 (s_buf *buf, u16 *dest)
+{
+ s_buf_save digits;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ u16 tmp;
+ u16 tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_u16_base(buf, &g_c3_base_binary, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_u16_base(buf, &g_c3_base_octal, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_u16_base(buf, g_c3_bases_hexadecimal,
+ &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_u16_base(buf, g_c3_bases_hexadecimal + 1,
+ &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_u16_base(buf, &g_c3_base_decimal, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_u16_base (s_buf *buf, const s_str *base,
+ u16 *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ u16 u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || (uw) radix > U16_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_u16_base: invalid radix");
+ errx(1, "buf_parse_u16_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_u16_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_u16_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > ceiling_u16(U16_MAX, radix)) {
+ warnx("buf_parse_u16_base: %llu * %llu: integer overflow",
+ (unsigned long long) u,
+ (unsigned long long) radix);
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (u > (u16) (U16_MAX - digit)) {
+ warnx("buf_parse_u16_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_u16.h b/libc3/buf_parse_u16.h
new file mode 100644
index 0000000..ef9b181
--- /dev/null
+++ b/libc3/buf_parse_u16.h
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.h.in BITS=16 bits=16 */
+#ifndef BUF_PARSE_U16_H
+#define BUF_PARSE_U16_H
+
+#include "types.h"
+
+sw buf_parse_u16 (s_buf *buf, u16 *dest);
+sw buf_parse_u16_base (s_buf *buf, const s_str *base,
+ u16 *dest);
+
+#endif /* #ifndef BUF_PARSE_U16_H */
diff --git a/libc3/buf_parse_u32.c b/libc3/buf_parse_u32.c
new file mode 100644
index 0000000..30163d9
--- /dev/null
+++ b/libc3/buf_parse_u32.c
@@ -0,0 +1,144 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.c.in BITS=32 bits=32 */
+
+#include "c3.h"
+
+sw buf_parse_u32 (s_buf *buf, u32 *dest)
+{
+ s_buf_save digits;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ u32 tmp;
+ u32 tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_u32_base(buf, &g_c3_base_binary, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_u32_base(buf, &g_c3_base_octal, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_u32_base(buf, g_c3_bases_hexadecimal,
+ &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_u32_base(buf, g_c3_bases_hexadecimal + 1,
+ &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_u32_base(buf, &g_c3_base_decimal, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_u32_base (s_buf *buf, const s_str *base,
+ u32 *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ u32 u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || (uw) radix > U32_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_u32_base: invalid radix");
+ errx(1, "buf_parse_u32_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_u32_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_u32_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > ceiling_u32(U32_MAX, radix)) {
+ warnx("buf_parse_u32_base: %llu * %llu: integer overflow",
+ (unsigned long long) u,
+ (unsigned long long) radix);
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (u > (u32) (U32_MAX - digit)) {
+ warnx("buf_parse_u32_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_u32.h b/libc3/buf_parse_u32.h
new file mode 100644
index 0000000..5d3706b
--- /dev/null
+++ b/libc3/buf_parse_u32.h
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.h.in BITS=32 bits=32 */
+#ifndef BUF_PARSE_U32_H
+#define BUF_PARSE_U32_H
+
+#include "types.h"
+
+sw buf_parse_u32 (s_buf *buf, u32 *dest);
+sw buf_parse_u32_base (s_buf *buf, const s_str *base,
+ u32 *dest);
+
+#endif /* #ifndef BUF_PARSE_U32_H */
diff --git a/libc3/buf_parse_u64.c b/libc3/buf_parse_u64.c
new file mode 100644
index 0000000..f758422
--- /dev/null
+++ b/libc3/buf_parse_u64.c
@@ -0,0 +1,144 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.c.in BITS=64 bits=64 */
+
+#include "c3.h"
+
+sw buf_parse_u64 (s_buf *buf, u64 *dest)
+{
+ s_buf_save digits;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ u64 tmp;
+ u64 tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_u64_base(buf, &g_c3_base_binary, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_u64_base(buf, &g_c3_base_octal, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_u64_base(buf, g_c3_bases_hexadecimal,
+ &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_u64_base(buf, g_c3_bases_hexadecimal + 1,
+ &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_u64_base(buf, &g_c3_base_decimal, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_u64_base (s_buf *buf, const s_str *base,
+ u64 *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ u64 u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || (uw) radix > U64_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_u64_base: invalid radix");
+ errx(1, "buf_parse_u64_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_u64_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_u64_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > ceiling_u64(U64_MAX, radix)) {
+ warnx("buf_parse_u64_base: %llu * %llu: integer overflow",
+ (unsigned long long) u,
+ (unsigned long long) radix);
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (u > (u64) (U64_MAX - digit)) {
+ warnx("buf_parse_u64_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_u64.h b/libc3/buf_parse_u64.h
new file mode 100644
index 0000000..de263b6
--- /dev/null
+++ b/libc3/buf_parse_u64.h
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.h.in BITS=64 bits=64 */
+#ifndef BUF_PARSE_U64_H
+#define BUF_PARSE_U64_H
+
+#include "types.h"
+
+sw buf_parse_u64 (s_buf *buf, u64 *dest);
+sw buf_parse_u64_base (s_buf *buf, const s_str *base,
+ u64 *dest);
+
+#endif /* #ifndef BUF_PARSE_U64_H */
diff --git a/libc3/buf_parse_u8.c b/libc3/buf_parse_u8.c
new file mode 100644
index 0000000..b14ecd6
--- /dev/null
+++ b/libc3/buf_parse_u8.c
@@ -0,0 +1,144 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.c.in BITS=8 bits=8 */
+
+#include "c3.h"
+
+sw buf_parse_u8 (s_buf *buf, u8 *dest)
+{
+ s_buf_save digits;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ u8 tmp;
+ u8 tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_u8_base(buf, &g_c3_base_binary, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_u8_base(buf, &g_c3_base_octal, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_u8_base(buf, g_c3_bases_hexadecimal,
+ &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_u8_base(buf, g_c3_bases_hexadecimal + 1,
+ &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_u8_base(buf, &g_c3_base_decimal, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_u8_base (s_buf *buf, const s_str *base,
+ u8 *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ u8 u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || (uw) radix > U8_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_u8_base: invalid radix");
+ errx(1, "buf_parse_u8_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_u8_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_u8_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > ceiling_u8(U8_MAX, radix)) {
+ warnx("buf_parse_u8_base: %llu * %llu: integer overflow",
+ (unsigned long long) u,
+ (unsigned long long) radix);
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (u > (u8) (U8_MAX - digit)) {
+ warnx("buf_parse_u8_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_u8.h b/libc3/buf_parse_u8.h
new file mode 100644
index 0000000..89931b2
--- /dev/null
+++ b/libc3/buf_parse_u8.h
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.h.in BITS=8 bits=8 */
+#ifndef BUF_PARSE_U8_H
+#define BUF_PARSE_U8_H
+
+#include "types.h"
+
+sw buf_parse_u8 (s_buf *buf, u8 *dest);
+sw buf_parse_u8_base (s_buf *buf, const s_str *base,
+ u8 *dest);
+
+#endif /* #ifndef BUF_PARSE_U8_H */
diff --git a/libc3/buf_parse_uw.c b/libc3/buf_parse_uw.c
new file mode 100644
index 0000000..3eaf9eb
--- /dev/null
+++ b/libc3/buf_parse_uw.c
@@ -0,0 +1,144 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.c.in BITS=W bits=w */
+
+#include "c3.h"
+
+sw buf_parse_uw (s_buf *buf, uw *dest)
+{
+ s_buf_save digits;
+ sw r;
+ sw r1;
+ sw result = 0;
+ s_buf_save save;
+ uw tmp;
+ uw tmp1;
+ buf_save_init(buf, &save);
+ if ((r = buf_read_1(buf, "0b")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_uw_base(buf, &g_c3_base_binary, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0o")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ if ((r = buf_parse_uw_base(buf, &g_c3_base_octal, dest)) <= 0)
+ goto restore;
+ result += r;
+ goto ok;
+ }
+ if ((r = buf_read_1(buf, "0x")) < 0)
+ goto restore;
+ if (r > 0) {
+ result += r;
+ buf_save_init(buf, &digits);
+ if ((r = buf_parse_uw_base(buf, g_c3_bases_hexadecimal,
+ &tmp)) < 0) {
+ buf_save_clean(buf, &digits);
+ goto restore;
+ }
+ buf_save_restore_rpos(buf, &digits);
+ buf_save_clean(buf, &digits);
+ if ((r1 = buf_parse_uw_base(buf, g_c3_bases_hexadecimal + 1,
+ &tmp1)) < 0) {
+ r = r1;
+ goto restore;
+ }
+ if (r == 0 && r1 == 0) {
+ warnx("invalid number: 0x");
+ goto restore;
+ }
+ if (r > r1) {
+ result += r;
+ *dest = tmp;
+ }
+ else {
+ result += r1;
+ *dest = tmp1;
+ }
+ goto ok;
+ }
+ if ((r = buf_parse_uw_base(buf, &g_c3_base_decimal, dest)) <= 0)
+ goto restore;
+ result += r;
+ ok:
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
+
+sw buf_parse_uw_base (s_buf *buf, const s_str *base,
+ uw *dest)
+{
+ u8 digit;
+ sw r;
+ sw radix;
+ sw result = 0;
+ s_buf_save save;
+ uw u = 0;
+ assert(buf);
+ assert(base);
+ assert(dest);
+ buf_save_init(buf, &save);
+ radix = str_length_utf8(base);
+ if (radix < 2 || (uw) radix > UW_MAX) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_uw_base: invalid radix");
+ errx(1, "buf_parse_uw_base: invalid radix: %ld",
+ radix);
+ return -1;
+ }
+ while ((r = buf_parse_digit(buf, base, &digit)) > 0) {
+ result += r;
+ if (digit >= radix) {
+ buf_save_clean(buf, &save);
+ assert(! "buf_parse_uw_base: digit greater than or equal to"
+ " radix");
+ errx(1, "buf_parse_uw_base: digit greater than or equal to"
+ " radix: %u",
+ digit);
+ return -1;
+ }
+ if (u > ceiling_uw(UW_MAX, radix)) {
+ warnx("buf_parse_uw_base: %llu * %llu: integer overflow",
+ (unsigned long long) u,
+ (unsigned long long) radix);
+ r = -1;
+ goto restore;
+ }
+ u *= radix;
+ if (u > (uw) (UW_MAX - digit)) {
+ warnx("buf_parse_uw_base: +: integer overflow");
+ r = -1;
+ goto restore;
+ }
+ u += digit;
+ }
+ *dest = u;
+ r = result;
+ goto clean;
+ restore:
+ buf_save_restore_rpos(buf, &save);
+ clean:
+ buf_save_clean(buf, &save);
+ return r;
+}
diff --git a/libc3/buf_parse_uw.h b/libc3/buf_parse_uw.h
new file mode 100644
index 0000000..d3935ed
--- /dev/null
+++ b/libc3/buf_parse_uw.h
@@ -0,0 +1,23 @@
+/* c3
+ * Copyright 2022,2023 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+/* Gen from buf_parse_u.h.in BITS=W bits=w */
+#ifndef BUF_PARSE_UW_H
+#define BUF_PARSE_UW_H
+
+#include "types.h"
+
+sw buf_parse_uw (s_buf *buf, uw *dest);
+sw buf_parse_uw_base (s_buf *buf, const s_str *base,
+ uw *dest);
+
+#endif /* #ifndef BUF_PARSE_UW_H */
diff --git a/libc3/gen.mk b/libc3/gen.mk
index 983c52b..4854cef 100644
--- a/libc3/gen.mk
+++ b/libc3/gen.mk
@@ -11,6 +11,16 @@
## THIS SOFTWARE.
GENERATED_FILES = \
+ buf_parse_s8.c buf_parse_s8.h \
+ buf_parse_s16.c buf_parse_s16.h \
+ buf_parse_s32.c buf_parse_s32.h \
+ buf_parse_s64.c buf_parse_s64.h \
+ buf_parse_sw.c buf_parse_sw.h \
+ buf_parse_u8.c buf_parse_u8.h \
+ buf_parse_u16.c buf_parse_u16.h \
+ buf_parse_u32.c buf_parse_u32.h \
+ buf_parse_u64.c buf_parse_u64.h \
+ buf_parse_uw.c buf_parse_uw.h \
set__fact.c set__fact.h \
set__tag.c set__tag.h \
set_cursor__fact.c set_cursor__fact.h \
@@ -22,64 +32,144 @@ GENERATED_FILES = \
gen: ${GENERATED_FILES}
+SED_BITS_8 = sed \
+ -e 's/_BITS[$$]/8/g' \
+ -e 's/_bits[$$]/8/g'
+
+buf_parse_s8.c: buf_parse_s.c.in gen.mk
+ ${SED_BITS_8} < buf_parse_s.c.in > buf_parse_s8.c
+
+buf_parse_s8.h: buf_parse_s.h.in gen.mk
+ ${SED_BITS_8} < buf_parse_s.h.in > buf_parse_s8.h
+
+buf_parse_u8.c: buf_parse_u.c.in gen.mk
+ ${SED_BITS_8} < buf_parse_u.c.in > buf_parse_u8.c
+
+buf_parse_u8.h: buf_parse_u.h.in gen.mk
+ ${SED_BITS_8} < buf_parse_u.h.in > buf_parse_u8.h
+
+SED_BITS_16 = sed \
+ -e 's/_BITS[$$]/16/g' \
+ -e 's/_bits[$$]/16/g'
+
+buf_parse_s16.c: buf_parse_s.c.in gen.mk
+ ${SED_BITS_16} < buf_parse_s.c.in > buf_parse_s16.c
+
+buf_parse_s16.h: buf_parse_s.h.in gen.mk
+ ${SED_BITS_16} < buf_parse_s.h.in > buf_parse_s16.h
+
+buf_parse_u16.c: buf_parse_u.c.in gen.mk
+ ${SED_BITS_16} < buf_parse_u.c.in > buf_parse_u16.c
+
+buf_parse_u16.h: buf_parse_u.h.in gen.mk
+ ${SED_BITS_16} < buf_parse_u.h.in > buf_parse_u16.h
+
+SED_BITS_32 = sed \
+ -e 's/_BITS[$$]/32/g' \
+ -e 's/_bits[$$]/32/g'
+
+buf_parse_s32.c: buf_parse_s.c.in gen.mk
+ ${SED_BITS_32} < buf_parse_s.c.in > buf_parse_s32.c
+
+buf_parse_s32.h: buf_parse_s.h.in gen.mk
+ ${SED_BITS_32} < buf_parse_s.h.in > buf_parse_s32.h
+
+buf_parse_u32.c: buf_parse_u.c.in gen.mk
+ ${SED_BITS_32} < buf_parse_u.c.in > buf_parse_u32.c
+
+buf_parse_u32.h: buf_parse_u.h.in gen.mk
+ ${SED_BITS_32} < buf_parse_u.h.in > buf_parse_u32.h
+
+SED_BITS_64 = sed \
+ -e 's/_BITS[$$]/64/g' \
+ -e 's/_bits[$$]/64/g'
+
+buf_parse_s64.c: buf_parse_s.c.in gen.mk
+ ${SED_BITS_64} < buf_parse_s.c.in > buf_parse_s64.c
+
+buf_parse_s64.h: buf_parse_s.h.in gen.mk
+ ${SED_BITS_64} < buf_parse_s.h.in > buf_parse_s64.h
+
+buf_parse_u64.c: buf_parse_u.c.in gen.mk
+ ${SED_BITS_64} < buf_parse_u.c.in > buf_parse_u64.c
+
+buf_parse_u64.h: buf_parse_u.h.in gen.mk
+ ${SED_BITS_64} < buf_parse_u.h.in > buf_parse_u64.h
+
+SED_BITS_W = sed \
+ -e 's/_BITS[$$]/W/g' \
+ -e 's/_bits[$$]/w/g'
+
+buf_parse_sw.c: buf_parse_s.c.in gen.mk
+ ${SED_BITS_W} < buf_parse_s.c.in > buf_parse_sw.c
+
+buf_parse_sw.h: buf_parse_s.h.in gen.mk
+ ${SED_BITS_W} < buf_parse_s.h.in > buf_parse_sw.h
+
+buf_parse_uw.c: buf_parse_u.c.in gen.mk
+ ${SED_BITS_W} < buf_parse_u.c.in > buf_parse_uw.c
+
+buf_parse_uw.h: buf_parse_u.h.in gen.mk
+ ${SED_BITS_W} < buf_parse_u.h.in > buf_parse_uw.h
+
SED_FACT = sed \
-e 's/_NAME[$$]/fact/g' \
-e 's/_TYPE[$$]/s_fact/g'
-set_cursor__fact.h: set_cursor.h.in Makefile
+set_cursor__fact.h: set_cursor.h.in gen.mk
${SED_FACT} < set_cursor.h.in > set_cursor__fact.h
-set_cursor__fact.c: set_cursor.c.in Makefile
+set_cursor__fact.c: set_cursor.c.in gen.mk
${SED_FACT} < set_cursor.c.in > set_cursor__fact.c
-set__fact.h: set.h.in Makefile
+set__fact.h: set.h.in gen.mk
${SED_FACT} < set.h.in > set__fact.h
-set__fact.c: set.c.in Makefile
+set__fact.c: set.c.in gen.mk
${SED_FACT} < set.c.in > set__fact.c
-set_item__fact.h: set_item.h.in Makefile
+set_item__fact.h: set_item.h.in gen.mk
${SED_FACT} < set_item.h.in > set_item__fact.h
-set_item__fact.c: set_item.c.in Makefile
+set_item__fact.c: set_item.c.in gen.mk
${SED_FACT} < set_item.c.in > set_item__fact.c
SED_FACT_P = sed \
-e 's/_NAME[$$]/fact/g' \
-e 's/_TYPE[$$]/s_fact */g'
-skiplist__fact.h: skiplist.h.in Makefile
+skiplist__fact.h: skiplist.h.in gen.mk
${SED_FACT_P} < skiplist.h.in > skiplist__fact.h
-skiplist__fact.c: skiplist.c.in Makefile
+skiplist__fact.c: skiplist.c.in gen.mk
${SED_FACT_P} < skiplist.c.in > skiplist__fact.c
-skiplist_node__fact.h: skiplist_node.h.in Makefile
+skiplist_node__fact.h: skiplist_node.h.in gen.mk
${SED_FACT_P} < skiplist_node.h.in > skiplist_node__fact.h
-skiplist_node__fact.c: skiplist_node.c.in Makefile
+skiplist_node__fact.c: skiplist_node.c.in gen.mk
${SED_FACT_P} < skiplist_node.c.in > skiplist_node__fact.c
SED_TAG = sed \
-e 's/_NAME[$$]/tag/g' \
-e 's/_TYPE[$$]/s_tag/g'
-set_cursor__tag.h: set_cursor.h.in Makefile
+set_cursor__tag.h: set_cursor.h.in gen.mk
${SED_TAG} < set_cursor.h.in > set_cursor__tag.h
-set_cursor__tag.c: set_cursor.c.in Makefile
+set_cursor__tag.c: set_cursor.c.in gen.mk
${SED_TAG} < set_cursor.c.in > set_cursor__tag.c
-set_item__tag.h: set_item.h.in Makefile
+set_item__tag.h: set_item.h.in gen.mk
${SED_TAG} < set_item.h.in > set_item__tag.h
-set_item__tag.c: set_item.c.in Makefile
+set_item__tag.c: set_item.c.in gen.mk
${SED_TAG} < set_item.c.in > set_item__tag.c
-set__tag.h: set.h.in Makefile
+set__tag.h: set.h.in gen.mk
${SED_TAG} < set.h.in > set__tag.h
-set__tag.c: set.c.in Makefile
+set__tag.c: set.c.in gen.mk
${SED_TAG} < set.c.in > set__tag.c
include sources.mk
diff --git a/libc3/sources.mk b/libc3/sources.mk
index f2e0d2e..0a1986d 100644
--- a/libc3/sources.mk
+++ b/libc3/sources.mk
@@ -10,6 +10,16 @@ HEADERS = \
buf_inspect.h \
buf_parse.h \
buf_parse_c.h \
+ buf_parse_s16.h \
+ buf_parse_s32.h \
+ buf_parse_s64.h \
+ buf_parse_s8.h \
+ buf_parse_sw.h \
+ buf_parse_u16.h \
+ buf_parse_u32.h \
+ buf_parse_u64.h \
+ buf_parse_u8.h \
+ buf_parse_uw.h \
buf_save.h \
c3.h \
c_types.h \
@@ -56,6 +66,7 @@ HEADERS = \
sym.h \
tag.h \
tuple.h \
+ type.h \
types.h \
ucd.h \
@@ -70,6 +81,16 @@ SOURCES = \
buf_inspect.c \
buf_parse.c \
buf_parse_c.c \
+ buf_parse_s16.c \
+ buf_parse_s32.c \
+ buf_parse_s64.c \
+ buf_parse_s8.c \
+ buf_parse_sw.c \
+ buf_parse_u16.c \
+ buf_parse_u32.c \
+ buf_parse_u64.c \
+ buf_parse_u8.c \
+ buf_parse_uw.c \
buf_save.c \
c3.c \
call.c \
@@ -112,6 +133,7 @@ SOURCES = \
sym.c \
tag.c \
tuple.c \
+ type.c \
ucd.c \
LO_SOURCES = \
@@ -125,6 +147,16 @@ LO_SOURCES = \
buf_inspect.c \
buf_parse.c \
buf_parse_c.c \
+ buf_parse_s16.c \
+ buf_parse_s32.c \
+ buf_parse_s64.c \
+ buf_parse_s8.c \
+ buf_parse_sw.c \
+ buf_parse_u16.c \
+ buf_parse_u32.c \
+ buf_parse_u64.c \
+ buf_parse_u8.c \
+ buf_parse_uw.c \
buf_save.c \
c3.c \
call.c \
@@ -167,6 +199,7 @@ LO_SOURCES = \
sym.c \
tag.c \
tuple.c \
+ type.c \
ucd.c \
../libtommath/bn_cutoffs.c \
../libtommath/bn_mp_2expt.c \
diff --git a/libc3/sources.sh b/libc3/sources.sh
index 811c356..00c157a 100644
--- a/libc3/sources.sh
+++ b/libc3/sources.sh
@@ -1,4 +1,4 @@
# sources.sh generated by update_sources
-HEADERS='abs.h arg.h array.h binding.h bool.h buf.h buf_file.h buf_inspect.h buf_parse.h buf_parse_c.h buf_save.h c3.h c_types.h call.h ceiling.h cfn.h character.h compare.h config.h env.h error.h error_handler.h eval.h fact.h facts.h facts_cursor.h facts_spec.h facts_spec_cursor.h facts_with.h facts_with_cursor.h float.h fn.h frame.h hash.h ident.h integer.h io.h list.h log.h module.h operator.h quote.h set__fact.h set__tag.h set_cursor__fact.h set_cursor__tag.h set_item__fact.h set_item__tag.h sha1.h sign.h skiplist__fact.h skiplist_node__fact.h str.h sym.h tag.h tuple.h types.h ucd.h '
-SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_parse.c buf_parse_c.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c fn.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c tuple.c ucd.c '
-LO_SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_parse.c buf_parse_c.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c fn.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c tuple.c ucd.c ../libtommath/bn_cutoffs.c ../libtommath/bn_mp_2expt.c ../libtommath/bn_mp_abs.c ../libtommath/bn_mp_add.c ../libtommath/bn_mp_add_d.c ../libtommath/bn_mp_and.c ../libtommath/bn_mp_clamp.c ../libtommath/bn_mp_clear.c ../libtommath/bn_mp_clear_multi.c ../libtommath/bn_mp_cmp.c ../libtommath/bn_mp_cmp_d.c ../libtommath/bn_mp_cmp_mag.c ../libtommath/bn_mp_cnt_lsb.c ../libtommath/bn_mp_complement.c ../libtommath/bn_mp_copy.c ../libtommath/bn_mp_count_bits.c ../libtommath/bn_mp_div.c ../libtommath/bn_mp_div_2.c ../libtommath/bn_mp_div_2d.c ../libtommath/bn_mp_div_3.c ../libtommath/bn_mp_div_d.c ../libtommath/bn_mp_dr_is_modulus.c ../libtommath/bn_mp_dr_reduce.c ../libtommath/bn_mp_dr_setup.c ../libtommath/bn_mp_error_to_string.c ../libtommath/bn_mp_exch.c ../libtommath/bn_mp_exptmod.c ../libtommath/bn_mp_gcd.c ../libtommath/bn_mp_get_i32.c ../libtommath/bn_mp_get_i64.c ../libtommath/bn_mp_get_mag_u32.c ../libtommath/bn_mp_get_mag_u64.c ../libtommath/bn_mp_grow.c ../libtommath/bn_mp_init.c ../libtommath/bn_mp_init_copy.c ../libtommath/bn_mp_init_multi.c ../libtommath/bn_mp_init_size.c ../libtommath/bn_mp_invmod.c ../libtommath/bn_mp_lcm.c ../libtommath/bn_mp_lshd.c ../libtommath/bn_mp_mod.c ../libtommath/bn_mp_mod_2d.c ../libtommath/bn_mp_montgomery_calc_normalization.c ../libtommath/bn_mp_montgomery_reduce.c ../libtommath/bn_mp_montgomery_setup.c ../libtommath/bn_mp_mul.c ../libtommath/bn_mp_mul_2.c ../libtommath/bn_mp_mul_2d.c ../libtommath/bn_mp_mul_d.c ../libtommath/bn_mp_mulmod.c ../libtommath/bn_mp_neg.c ../libtommath/bn_mp_or.c ../libtommath/bn_mp_radix_size.c ../libtommath/bn_mp_reduce.c ../libtommath/bn_mp_reduce_2k.c ../libtommath/bn_mp_reduce_2k_l.c ../libtommath/bn_mp_reduce_2k_setup.c ../libtommath/bn_mp_reduce_2k_setup_l.c ../libtommath/bn_mp_reduce_is_2k.c ../libtommath/bn_mp_reduce_is_2k_l.c ../libtommath/bn_mp_reduce_setup.c ../libtommath/bn_mp_rshd.c ../libtommath/bn_mp_set.c ../libtommath/bn_mp_sqr.c ../libtommath/bn_mp_sqrt.c ../libtommath/bn_mp_sub.c ../libtommath/bn_mp_sub_d.c ../libtommath/bn_mp_xor.c ../libtommath/bn_mp_zero.c ../libtommath/bn_s_mp_add.c ../libtommath/bn_s_mp_balance_mul.c ../libtommath/bn_s_mp_exptmod.c ../libtommath/bn_s_mp_exptmod_fast.c ../libtommath/bn_s_mp_invmod_fast.c ../libtommath/bn_s_mp_invmod_slow.c ../libtommath/bn_s_mp_karatsuba_mul.c ../libtommath/bn_s_mp_karatsuba_sqr.c ../libtommath/bn_s_mp_montgomery_reduce_fast.c ../libtommath/bn_s_mp_mul_digs.c ../libtommath/bn_s_mp_mul_digs_fast.c ../libtommath/bn_s_mp_mul_high_digs.c ../libtommath/bn_s_mp_mul_high_digs_fast.c ../libtommath/bn_s_mp_rand_platform.c ../libtommath/bn_s_mp_sqr.c ../libtommath/bn_s_mp_sqr_fast.c ../libtommath/bn_s_mp_sub.c ../libtommath/bn_s_mp_toom_mul.c ../libtommath/bn_s_mp_toom_sqr.c '
+HEADERS='abs.h arg.h array.h binding.h bool.h buf.h buf_file.h buf_inspect.h buf_parse.h buf_parse_c.h buf_parse_s16.h buf_parse_s32.h buf_parse_s64.h buf_parse_s8.h buf_parse_sw.h buf_parse_u16.h buf_parse_u32.h buf_parse_u64.h buf_parse_u8.h buf_parse_uw.h buf_save.h c3.h c_types.h call.h ceiling.h cfn.h character.h compare.h config.h env.h error.h error_handler.h eval.h fact.h facts.h facts_cursor.h facts_spec.h facts_spec_cursor.h facts_with.h facts_with_cursor.h float.h fn.h frame.h hash.h ident.h integer.h io.h list.h log.h module.h operator.h quote.h set__fact.h set__tag.h set_cursor__fact.h set_cursor__tag.h set_item__fact.h set_item__tag.h sha1.h sign.h skiplist__fact.h skiplist_node__fact.h str.h sym.h tag.h tuple.h type.h types.h ucd.h '
+SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_parse.c buf_parse_c.c buf_parse_s16.c buf_parse_s32.c buf_parse_s64.c buf_parse_s8.c buf_parse_sw.c buf_parse_u16.c buf_parse_u32.c buf_parse_u64.c buf_parse_u8.c buf_parse_uw.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c fn.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c tuple.c type.c ucd.c '
+LO_SOURCES='abs.c arg.c array.c binding.c bool.c buf.c buf_file.c buf_inspect.c buf_parse.c buf_parse_c.c buf_parse_s16.c buf_parse_s32.c buf_parse_s64.c buf_parse_s8.c buf_parse_sw.c buf_parse_u16.c buf_parse_u32.c buf_parse_u64.c buf_parse_u8.c buf_parse_uw.c buf_save.c c3.c call.c ceiling.c cfn.c character.c compare.c env.c error.c error_handler.c eval.c fact.c facts.c facts_cursor.c facts_spec.c facts_spec_cursor.c facts_with.c facts_with_cursor.c fn.c frame.c hash.c ident.c integer.c io.c list.c log.c module.c operator.c quote.c set__fact.c set__tag.c set_cursor__fact.c set_cursor__tag.c set_item__fact.c set_item__tag.c sign.c skiplist__fact.c skiplist_node__fact.c str.c sym.c tag.c tuple.c type.c ucd.c ../libtommath/bn_cutoffs.c ../libtommath/bn_mp_2expt.c ../libtommath/bn_mp_abs.c ../libtommath/bn_mp_add.c ../libtommath/bn_mp_add_d.c ../libtommath/bn_mp_and.c ../libtommath/bn_mp_clamp.c ../libtommath/bn_mp_clear.c ../libtommath/bn_mp_clear_multi.c ../libtommath/bn_mp_cmp.c ../libtommath/bn_mp_cmp_d.c ../libtommath/bn_mp_cmp_mag.c ../libtommath/bn_mp_cnt_lsb.c ../libtommath/bn_mp_complement.c ../libtommath/bn_mp_copy.c ../libtommath/bn_mp_count_bits.c ../libtommath/bn_mp_div.c ../libtommath/bn_mp_div_2.c ../libtommath/bn_mp_div_2d.c ../libtommath/bn_mp_div_3.c ../libtommath/bn_mp_div_d.c ../libtommath/bn_mp_dr_is_modulus.c ../libtommath/bn_mp_dr_reduce.c ../libtommath/bn_mp_dr_setup.c ../libtommath/bn_mp_error_to_string.c ../libtommath/bn_mp_exch.c ../libtommath/bn_mp_exptmod.c ../libtommath/bn_mp_gcd.c ../libtommath/bn_mp_get_i32.c ../libtommath/bn_mp_get_i64.c ../libtommath/bn_mp_get_mag_u32.c ../libtommath/bn_mp_get_mag_u64.c ../libtommath/bn_mp_grow.c ../libtommath/bn_mp_init.c ../libtommath/bn_mp_init_copy.c ../libtommath/bn_mp_init_multi.c ../libtommath/bn_mp_init_size.c ../libtommath/bn_mp_invmod.c ../libtommath/bn_mp_lcm.c ../libtommath/bn_mp_lshd.c ../libtommath/bn_mp_mod.c ../libtommath/bn_mp_mod_2d.c ../libtommath/bn_mp_montgomery_calc_normalization.c ../libtommath/bn_mp_montgomery_reduce.c ../libtommath/bn_mp_montgomery_setup.c ../libtommath/bn_mp_mul.c ../libtommath/bn_mp_mul_2.c ../libtommath/bn_mp_mul_2d.c ../libtommath/bn_mp_mul_d.c ../libtommath/bn_mp_mulmod.c ../libtommath/bn_mp_neg.c ../libtommath/bn_mp_or.c ../libtommath/bn_mp_radix_size.c ../libtommath/bn_mp_reduce.c ../libtommath/bn_mp_reduce_2k.c ../libtommath/bn_mp_reduce_2k_l.c ../libtommath/bn_mp_reduce_2k_setup.c ../libtommath/bn_mp_reduce_2k_setup_l.c ../libtommath/bn_mp_reduce_is_2k.c ../libtommath/bn_mp_reduce_is_2k_l.c ../libtommath/bn_mp_reduce_setup.c ../libtommath/bn_mp_rshd.c ../libtommath/bn_mp_set.c ../libtommath/bn_mp_sqr.c ../libtommath/bn_mp_sqrt.c ../libtommath/bn_mp_sub.c ../libtommath/bn_mp_sub_d.c ../libtommath/bn_mp_xor.c ../libtommath/bn_mp_zero.c ../libtommath/bn_s_mp_add.c ../libtommath/bn_s_mp_balance_mul.c ../libtommath/bn_s_mp_exptmod.c ../libtommath/bn_s_mp_exptmod_fast.c ../libtommath/bn_s_mp_invmod_fast.c ../libtommath/bn_s_mp_invmod_slow.c ../libtommath/bn_s_mp_karatsuba_mul.c ../libtommath/bn_s_mp_karatsuba_sqr.c ../libtommath/bn_s_mp_montgomery_reduce_fast.c ../libtommath/bn_s_mp_mul_digs.c ../libtommath/bn_s_mp_mul_digs_fast.c ../libtommath/bn_s_mp_mul_high_digs.c ../libtommath/bn_s_mp_mul_high_digs_fast.c ../libtommath/bn_s_mp_rand_platform.c ../libtommath/bn_s_mp_sqr.c ../libtommath/bn_s_mp_sqr_fast.c ../libtommath/bn_s_mp_sub.c ../libtommath/bn_s_mp_toom_mul.c ../libtommath/bn_s_mp_toom_sqr.c '
diff --git a/sources.mk b/sources.mk
index 74eb54e..37cb690 100644
--- a/sources.mk
+++ b/sources.mk
@@ -5,12 +5,12 @@ C3_CONFIGURES = \
c3s/update_sources \
ic3/configure \
ic3/update_sources \
- libc3/configure \
libc3/update_sources \
+ libc3/configure \
libtommath/configure \
libtommath/update_sources \
- test/update_sources \
test/configure \
+ test/update_sources \
ucd2c/configure \
C3_MAKEFILES = \
@@ -34,14 +34,10 @@ C3_C_SOURCES = \
ic3/linenoise.c \
libc3/arg.c \
libc3/arg.h \
- libc3/set__fact.c \
- libc3/set__fact.h \
- libc3/set__tag.c \
- libc3/set__tag.h \
- libc3/set_cursor__fact.c \
- libc3/set_cursor__fact.h \
- libc3/set_cursor__tag.c \
- libc3/set_cursor__tag.h \
+ libc3/skiplist__fact.c \
+ libc3/skiplist__fact.h \
+ libc3/skiplist_node__fact.c \
+ libc3/skiplist_node__fact.h \
libc3/binding.c \
libc3/binding.h \
libc3/facts.c \
@@ -49,12 +45,20 @@ C3_C_SOURCES = \
libc3/array.c \
libc3/array.h \
libc3/buf.c \
+ libc3/buf_parse.c \
+ libc3/integer.h \
+ libc3/types.h \
+ libc3/type.c \
+ libc3/set__fact.c \
+ libc3/set__fact.h \
+ libc3/set__tag.c \
+ libc3/set__tag.h \
+ libc3/set_cursor__fact.c \
libc3/buf_file.c \
libc3/buf_file.h \
libc3/bool.c \
libc3/io.h \
libc3/io.c \
- libc3/buf_parse.c \
libc3/abs.h \
libc3/ceiling.c \
libc3/buf_parse_c.c \
@@ -63,14 +67,6 @@ C3_C_SOURCES = \
libc3/buf_parse.h \
libc3/compare.c \
libc3/buf_inspect.c \
- libc3/set_item__fact.c \
- libc3/set_item__fact.h \
- libc3/set_item__tag.c \
- libc3/set_item__tag.h \
- libc3/skiplist__fact.c \
- libc3/skiplist__fact.h \
- libc3/skiplist_node__fact.c \
- libc3/skiplist_node__fact.h \
libc3/call.c \
libc3/bool.h \
libc3/buf_save.h \
@@ -88,6 +84,13 @@ C3_C_SOURCES = \
libc3/tag.h \
libc3/sign.h \
libc3/buf.h \
+ libc3/set_cursor__fact.h \
+ libc3/set_cursor__tag.c \
+ libc3/set_cursor__tag.h \
+ libc3/set_item__fact.c \
+ libc3/set_item__fact.h \
+ libc3/set_item__tag.c \
+ libc3/set_item__tag.h \
libc3/ident.c \
libc3/error_handler.c \
libc3/frame.c \
@@ -131,9 +134,7 @@ C3_C_SOURCES = \
libc3/module.c \
libc3/quote.c \
libc3/quote.h \
- libc3/integer.h \
libc3/character.c \
- libc3/types.h \
libc3/cfn.c \
libc3/fn.c \
libc3/module.h \
@@ -151,6 +152,31 @@ C3_C_SOURCES = \
libc3/tuple.h \
libc3/ucd.c \
libc3/ucd.h \
+ libc3/buf_parse_s8.h \
+ libc3/type.h \
+ libc3/buf_parse_s.h.in \
+ libc3/buf_parse_u.h.in \
+ libc3/buf_parse_s16.h \
+ libc3/buf_parse_s32.h \
+ libc3/buf_parse_s64.h \
+ libc3/buf_parse_sw.h \
+ libc3/buf_parse_u8.h \
+ libc3/buf_parse_u16.h \
+ libc3/buf_parse_u32.h \
+ libc3/buf_parse_u64.h \
+ libc3/buf_parse_uw.h \
+ libc3/buf_parse_s8.c \
+ libc3/buf_parse_s16.c \
+ libc3/buf_parse_s.c.in \
+ libc3/buf_parse_s32.c \
+ libc3/buf_parse_s64.c \
+ libc3/buf_parse_sw.c \
+ libc3/buf_parse_u8.c \
+ libc3/buf_parse_u16.c \
+ libc3/buf_parse_u.c.in \
+ libc3/buf_parse_u32.c \
+ libc3/buf_parse_u64.c \
+ libc3/buf_parse_uw.c \
libc3/float.h \
test/facts_cursor_test.c \
test/facts_test.c \
@@ -178,7 +204,6 @@ C3_C_SOURCES = \
test/test.h \
test/bool_test.c \
test/cfn_test.c \
- test/buf_parse_test.c \
test/buf_parse_test_s8.c \
test/buf_parse_test_s32.c \
test/buf_parse_test_s64.c \
@@ -191,6 +216,7 @@ C3_C_SOURCES = \
test/env_test.c \
test/buf_parse_test_su.h \
test/character_test.c \
+ test/buf_parse_test.c \
test/buf_parse_test_s16.c \
test/buf_file_test.c \
ucd2c/ucd.h \
diff --git a/sources.sh b/sources.sh
index afd3ca4..6d8bb99 100644
--- a/sources.sh
+++ b/sources.sh
@@ -1,4 +1,4 @@
# sources.sh generated by update_sources
-C3_CONFIGURES='c3c/configure c3s/configure c3s/update_sources ic3/configure ic3/update_sources libc3/configure libc3/update_sources libtommath/configure libtommath/update_sources test/update_sources test/configure ucd2c/configure '
+C3_CONFIGURES='c3c/configure c3s/configure c3s/update_sources ic3/configure ic3/update_sources libc3/update_sources libc3/configure libtommath/configure libtommath/update_sources test/configure test/update_sources ucd2c/configure '
C3_MAKEFILES='c3c/Makefile c3s/Makefile ic3/Makefile libc3/Makefile libc3/gen.mk libtommath/Makefile test/Makefile ucd2c/Makefile '
-C3_C_SOURCES='c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/buf_linenoise.c ic3/ic3.c ic3/buf_linenoise.h ic3/linenoise.c libc3/arg.c libc3/arg.h libc3/set__fact.c libc3/set__fact.h libc3/set__tag.c libc3/set__tag.h libc3/set_cursor__fact.c libc3/set_cursor__fact.h libc3/set_cursor__tag.c libc3/set_cursor__tag.h libc3/binding.c libc3/binding.h libc3/facts.c libc3/facts_with_cursor.c libc3/array.c libc3/array.h libc3/buf.c libc3/buf_file.c libc3/buf_file.h libc3/bool.c libc3/io.h libc3/io.c libc3/buf_parse.c libc3/abs.h libc3/ceiling.c libc3/buf_parse_c.c libc3/buf_parse_c.h libc3/buf_save.c libc3/buf_parse.h libc3/compare.c libc3/buf_inspect.c libc3/set_item__fact.c libc3/set_item__fact.h libc3/set_item__tag.c libc3/set_item__tag.h libc3/skiplist__fact.c libc3/skiplist__fact.h libc3/skiplist_node__fact.c libc3/skiplist_node__fact.h libc3/call.c libc3/bool.h libc3/buf_save.h libc3/fact.h libc3/error.c libc3/list.h libc3/c3.c libc3/c3.h libc3/error.h libc3/env.h libc3/character.h libc3/compare.h libc3/operator.h libc3/operator.c libc3/tag.h libc3/sign.h libc3/buf.h libc3/ident.c libc3/error_handler.c libc3/frame.c libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/set_item.c.in libc3/set_item.h.in libc3/error_handler.h libc3/eval.c libc3/eval.h libc3/fact.c libc3/facts.h libc3/facts_cursor.c libc3/fn.h libc3/ceiling.h libc3/buf_inspect.h libc3/env.c libc3/facts_cursor.h libc3/facts_spec.c libc3/frame.h libc3/sign.c libc3/facts_spec.h libc3/facts_spec_cursor.c libc3/hash.c libc3/facts_spec_cursor.h libc3/facts_with.c libc3/facts_with.h libc3/hash.h libc3/cfn.h libc3/tag.c libc3/abs.c libc3/facts_with_cursor.h libc3/ident.h libc3/str.c libc3/c_types.h libc3/integer.c libc3/list.c libc3/log.c libc3/log.h libc3/sym.h libc3/module.c libc3/quote.c libc3/quote.h libc3/integer.h libc3/character.c libc3/types.h libc3/cfn.c libc3/fn.c libc3/module.h libc3/set.c.in libc3/call.h libc3/set.h.in libc3/sha1.h libc3/skiplist.c.in libc3/skiplist.h.in libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/str.h libc3/sym.c libc3/tuple.c libc3/tuple.h libc3/ucd.c libc3/ucd.h libc3/float.h test/facts_cursor_test.c test/facts_test.c test/facts_with_test.c test/set__fact_test.c test/set__tag_test.c test/test.c test/tag_test.c test/sym_test.c test/tag_test.h test/tuple_test.c test/types_test.c test/skiplist__fact_test.c test/fact_test.c test/compare_test.h test/fact_test.h test/str_test.c test/list_test.c test/hash_test.c test/compare_test.c test/call_test.c test/ident_test.c test/libc3_test.c test/buf_inspect_test.c test/test.h test/bool_test.c test/cfn_test.c test/buf_parse_test.c test/buf_parse_test_s8.c test/buf_parse_test_s32.c test/buf_parse_test_s64.c test/buf_parse_test_u16.c test/buf_parse_test_u8.c test/buf_parse_test_u32.c test/buf_parse_test_u64.c test/buf_parse_test.h test/buf_test.c test/env_test.c test/buf_parse_test_su.h test/character_test.c test/buf_parse_test_s16.c test/buf_file_test.c ucd2c/ucd.h ucd2c/ucd2c.c '
+C3_C_SOURCES='c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/buf_linenoise.c ic3/ic3.c ic3/buf_linenoise.h ic3/linenoise.c libc3/arg.c libc3/arg.h libc3/skiplist__fact.c libc3/skiplist__fact.h libc3/skiplist_node__fact.c libc3/skiplist_node__fact.h libc3/binding.c libc3/binding.h libc3/facts.c libc3/facts_with_cursor.c libc3/array.c libc3/array.h libc3/buf.c libc3/buf_parse.c libc3/integer.h libc3/types.h libc3/type.c libc3/set__fact.c libc3/set__fact.h libc3/set__tag.c libc3/set__tag.h libc3/set_cursor__fact.c libc3/buf_file.c libc3/buf_file.h libc3/bool.c libc3/io.h libc3/io.c libc3/abs.h libc3/ceiling.c libc3/buf_parse_c.c libc3/buf_parse_c.h libc3/buf_save.c libc3/buf_parse.h libc3/compare.c libc3/buf_inspect.c libc3/call.c libc3/bool.h libc3/buf_save.h libc3/fact.h libc3/error.c libc3/list.h libc3/c3.c libc3/c3.h libc3/error.h libc3/env.h libc3/character.h libc3/compare.h libc3/operator.h libc3/operator.c libc3/tag.h libc3/sign.h libc3/buf.h libc3/set_cursor__fact.h libc3/set_cursor__tag.c libc3/set_cursor__tag.h libc3/set_item__fact.c libc3/set_item__fact.h libc3/set_item__tag.c libc3/set_item__tag.h libc3/ident.c libc3/error_handler.c libc3/frame.c libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/set_item.c.in libc3/set_item.h.in libc3/error_handler.h libc3/eval.c libc3/eval.h libc3/fact.c libc3/facts.h libc3/facts_cursor.c libc3/fn.h libc3/ceiling.h libc3/buf_inspect.h libc3/env.c libc3/facts_cursor.h libc3/facts_spec.c libc3/frame.h libc3/sign.c libc3/facts_spec.h libc3/facts_spec_cursor.c libc3/hash.c libc3/facts_spec_cursor.h libc3/facts_with.c libc3/facts_with.h libc3/hash.h libc3/cfn.h libc3/tag.c libc3/abs.c libc3/facts_with_cursor.h libc3/ident.h libc3/str.c libc3/c_types.h libc3/integer.c libc3/list.c libc3/log.c libc3/log.h libc3/sym.h libc3/module.c libc3/quote.c libc3/quote.h libc3/character.c libc3/cfn.c libc3/fn.c libc3/module.h libc3/set.c.in libc3/call.h libc3/set.h.in libc3/sha1.h libc3/skiplist.c.in libc3/skiplist.h.in libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/str.h libc3/sym.c libc3/tuple.c libc3/tuple.h libc3/ucd.c libc3/ucd.h libc3/buf_parse_s8.h libc3/type.h libc3/buf_parse_s.h.in libc3/buf_parse_u.h.in libc3/buf_parse_s16.h libc3/buf_parse_s32.h libc3/buf_parse_s64.h libc3/buf_parse_sw.h libc3/buf_parse_u8.h libc3/buf_parse_u16.h libc3/buf_parse_u32.h libc3/buf_parse_u64.h libc3/buf_parse_uw.h libc3/buf_parse_s8.c libc3/buf_parse_s16.c libc3/buf_parse_s.c.in libc3/buf_parse_s32.c libc3/buf_parse_s64.c libc3/buf_parse_sw.c libc3/buf_parse_u8.c libc3/buf_parse_u16.c libc3/buf_parse_u.c.in libc3/buf_parse_u32.c libc3/buf_parse_u64.c libc3/buf_parse_uw.c libc3/float.h test/facts_cursor_test.c test/facts_test.c test/facts_with_test.c test/set__fact_test.c test/set__tag_test.c test/test.c test/tag_test.c test/sym_test.c test/tag_test.h test/tuple_test.c test/types_test.c test/skiplist__fact_test.c test/fact_test.c test/compare_test.h test/fact_test.h test/str_test.c test/list_test.c test/hash_test.c test/compare_test.c test/call_test.c test/ident_test.c test/libc3_test.c test/buf_inspect_test.c test/test.h test/bool_test.c test/cfn_test.c test/buf_parse_test_s8.c test/buf_parse_test_s32.c test/buf_parse_test_s64.c test/buf_parse_test_u16.c test/buf_parse_test_u8.c test/buf_parse_test_u32.c test/buf_parse_test_u64.c test/buf_parse_test.h test/buf_test.c test/env_test.c test/buf_parse_test_su.h test/character_test.c test/buf_parse_test.c test/buf_parse_test_s16.c test/buf_file_test.c ucd2c/ucd.h ucd2c/ucd2c.c '