all repos — hex @ 26c67a96ef7a41d84df62f2b281dcc64b6e4eed5

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

Made int and str only support strings or integers respectively.
h3rald h3rald@h3rald.com
Sun, 08 Dec 2024 17:26:12 +0100
commit

26c67a96ef7a41d84df62f2b281dcc64b6e4eed5

parent

ba2d7ebcbd0cefa7d844d9ea03dc19f5c9f38676

1 files changed, 2 insertions(+), 10 deletions(-)

jump to
M src/hex.csrc/hex.c

@@ -488,8 +488,8 @@ hex_doc(docs, "not", "i", "i", "Returns 0x1 if 'i' is 0x0, 0x0 otherwise.");

hex_doc(docs, "xor", "i1 i2", "i", "Returns 0x1 if only one item is not 0x0."); // Type - hex_doc(docs, "int", "(i|s)", "i", "Converts a string to a hex integer."); - hex_doc(docs, "str", "(i|s)", "s", "Converts a hex integer to a string."); + hex_doc(docs, "int", "s", "i", "Converts a string to a hex integer."); + hex_doc(docs, "str", "i", "s", "Converts a hex integer to a string."); hex_doc(docs, "dec", "i", "s", "Converts a hex integer to a decimal string."); hex_doc(docs, "hex", "s", "i", "Converter a decimal string to a hex integer."); hex_doc(docs, "type", "a", "s", "Pushes the data type of 'a' on the stack.");

@@ -1599,10 +1599,6 @@ hex_error(ctx, "Cannot convert a quotation to an integer");

FREE(ctx, a); return 1; } - if (a.type == HEX_TYPE_INTEGER) - { - return hex_push_integer(ctx, a.data.int_value); - } if (a.type == HEX_TYPE_STRING) { return hex_push_integer(ctx, strtol(a.data.str_value, NULL, 16));

@@ -1630,10 +1626,6 @@ }

if (a.type == HEX_TYPE_INTEGER) { return hex_push_string(ctx, hex_itoa_hex(a.data.int_value)); - } - if (a.type == HEX_TYPE_STRING) - { - return hex_push_string(ctx, a.data.str_value); } hex_error(ctx, "Unsupported data type: %s", hex_type(a.type)); FREE(ctx, a);