From ad21a98d6a351e055071c838eeee3158871319e1 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sat, 19 Jul 2025 22:13:47 -0700 Subject: [PATCH 01/33] Update output.c --- code/logic/output.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/logic/output.c b/code/logic/output.c index c696cfd..b39dcc1 100644 --- a/code/logic/output.c +++ b/code/logic/output.c @@ -85,6 +85,8 @@ void fossil_io_apply_color(const char *color) { printf(FOSSIL_IO_COLOR_BRIGHT_CYAN); } else if (strcmp(color, "bright_white") == 0) { printf(FOSSIL_IO_COLOR_BRIGHT_WHITE); + } else { + printf(FOSSIL_IO_COLOR_RESET); // Reset to default if color not recognized } } From 878f396de52991f66e264d90582f2e656a61e627 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sat, 19 Jul 2025 22:22:20 -0700 Subject: [PATCH 02/33] Update output.c --- code/logic/output.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/code/logic/output.c b/code/logic/output.c index b39dcc1..5a43d7f 100644 --- a/code/logic/output.c +++ b/code/logic/output.c @@ -114,19 +114,30 @@ void fossil_io_apply_attribute(const char *attribute) { // Function to handle named positions (like top, bottom, left, right) void fossil_io_apply_position(const char *pos) { if (strcmp(pos, "top") == 0) { - // Apply position logic for top - printf("\033[H"); // Move cursor to the top + printf("\033[1;1H"); // Move to top } else if (strcmp(pos, "bottom") == 0) { - // Apply position logic for bottom - printf("\033[1000H"); // Move cursor to the bottom (just as an example) + printf("\033[1000;1H"); // Move cursor to bottom-left } else if (strcmp(pos, "left") == 0) { - // Apply position logic for left - printf("\033[1000;0H"); // Move cursor to the left + printf("\033[1;1H"); // Move to top-left (as a general left start) } else if (strcmp(pos, "right") == 0) { - // Apply position logic for right - printf("\033[1000;1000H"); // Move cursor to the right + printf("\033[1;1000H"); // Move to top-right + } else if (strcmp(pos, "center") == 0) { + printf("\033[25;40H"); // Approximate center for 80x50 terminal + } else if (strcmp(pos, "top-left") == 0) { + printf("\033[1;1H"); + } else if (strcmp(pos, "top-right") == 0) { + printf("\033[1;1000H"); + } else if (strcmp(pos, "bottom-left") == 0) { + printf("\033[1000;1H"); + } else if (strcmp(pos, "bottom-right") == 0) { + printf("\033[1000;1000H"); + } else if (strcmp(pos, "middle-left") == 0) { + printf("\033[25;1H"); // Mid vertical, far left + } else if (strcmp(pos, "middle-right") == 0) { + printf("\033[25;1000H"); // Mid vertical, far right + } else { + fprintf(stderr, "Unknown position: %s\n", pos); } - // Add more positions if needed } // Function to print text with attributes, colors, positions, and format specifiers From 19737f755187ae49675b7f44e0e177256f0780d1 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sat, 19 Jul 2025 22:43:12 -0700 Subject: [PATCH 03/33] Update network.c --- code/logic/network.c | 196 ++++++++++++++++++++++++++++++------------- 1 file changed, 140 insertions(+), 56 deletions(-) diff --git a/code/logic/network.c b/code/logic/network.c index e090d03..6fa1177 100644 --- a/code/logic/network.c +++ b/code/logic/network.c @@ -148,66 +148,72 @@ fossil_nstream_t *fossil_nstream_create(const char *protocol_flag, const char *c fossil_set_last_error("Socket system initialization failed"); return NULL; } - + if (!protocol_flag || !client_type_flag) { fossil_set_last_error("Invalid protocol or client type flag"); return NULL; } - + fossil_protocol_t protocol = fossil_protocol_from_string(protocol_flag); fossil_client_type_t client_type = fossil_client_type_from_string(client_type_flag); - + if (protocol == FOSSIL_PROTO_UNKNOWN) { fossil_set_last_error("Unsupported protocol"); return NULL; } - + if (client_type == FOSSIL_CLIENT_UNKNOWN) { fossil_set_last_error("Unsupported client type"); return NULL; } - + + // Validate protocol-specific constraints + switch (protocol) { + case FOSSIL_PROTO_ICMP: + case FOSSIL_PROTO_RAW: + #ifndef _WIN32 + if (geteuid() != 0) { + fossil_set_last_error("ICMP/RAW sockets require root privileges"); + return NULL; + } + #endif + break; + case FOSSIL_PROTO_HTTP: + case FOSSIL_PROTO_HTTPS: + case FOSSIL_PROTO_FTP: + case FOSSIL_PROTO_SSH: + case FOSSIL_PROTO_SMTP: + case FOSSIL_PROTO_POP3: + case FOSSIL_PROTO_IMAP: + case FOSSIL_PROTO_LDAP: + case FOSSIL_PROTO_MQTT: + // These are application-layer protocols; you may optionally enforce TCP + if (protocol != FOSSIL_PROTO_TCP && protocol != FOSSIL_PROTO_HTTPS) { + fossil_set_last_error("Application protocols require TCP/SSL"); + return NULL; + } + break; + case FOSSIL_PROTO_DNS: + case FOSSIL_PROTO_NTP: + // These typically use UDP + break; + default: + break; + } + fossil_nstream_t *stream = (fossil_nstream_t *)calloc(1, sizeof(fossil_nstream_t)); if (!stream) { fossil_set_last_error("Memory allocation failed"); return NULL; } - + stream->protocol = protocol; stream->client_type = client_type; snprintf(stream->protocol_flag, sizeof(stream->protocol_flag), "%s", protocol_flag); snprintf(stream->client_type_flag, sizeof(stream->client_type_flag), "%s", client_type_flag); stream->socket_fd = -1; - return stream; -} -static socket_t fossil_create_socket(fossil_protocol_t proto) { - int type = SOCK_STREAM; - int proto_num = IPPROTO_TCP; - - switch (proto) { - case FOSSIL_PROTO_TCP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; - case FOSSIL_PROTO_UDP: type = SOCK_DGRAM; proto_num = IPPROTO_UDP; break; - case FOSSIL_PROTO_RAW: type = SOCK_RAW; proto_num = IPPROTO_RAW; break; - case FOSSIL_PROTO_ICMP: type = SOCK_RAW; proto_num = IPPROTO_ICMP; break; - case FOSSIL_PROTO_SCTP: type = SOCK_STREAM; proto_num = IPPROTO_SCTP; break; - case FOSSIL_PROTO_HTTP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; - case FOSSIL_PROTO_HTTPS: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; - case FOSSIL_PROTO_FTP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; - case FOSSIL_PROTO_SSH: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; - case FOSSIL_PROTO_DNS: type = SOCK_DGRAM; proto_num = IPPROTO_UDP; break; - case FOSSIL_PROTO_NTP: type = SOCK_DGRAM; proto_num = IPPROTO_UDP; break; - case FOSSIL_PROTO_SMTP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; - case FOSSIL_PROTO_POP3: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; - case FOSSIL_PROTO_IMAP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; - case FOSSIL_PROTO_LDAP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; - case FOSSIL_PROTO_MQTT: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; - default: - fossil_set_last_error("Unsupported protocol for socket creation"); - return -1; - } - - return socket(AF_INET, type, proto_num); + return stream; } int fossil_nstream_connect(fossil_nstream_t *stream, const char *host, int port) { @@ -215,27 +221,55 @@ int fossil_nstream_connect(fossil_nstream_t *stream, const char *host, int port) fossil_set_last_error("Stream is NULL"); return -1; } - + + // Validate protocol connect support + switch (stream->protocol) { + case FOSSIL_PROTO_ICMP: + case FOSSIL_PROTO_RAW: + fossil_set_last_error("Protocol does not support connect() in traditional sense"); + return -1; + default: + break; // Proceed for connect-capable protocols + } + stream->socket_fd = fossil_create_socket(stream->protocol); if ((int)stream->socket_fd < 0) { - return -1; + return -1; // fossil_create_socket() already sets error } - + struct sockaddr_in addr = {0}; addr.sin_family = AF_INET; addr.sin_port = htons(port); - + if (inet_pton(AF_INET, host, &addr.sin_addr) <= 0) { fossil_set_last_error("Invalid address or address not supported"); +#ifdef _WIN32 + closesocket(stream->socket_fd); +#else + close(stream->socket_fd); +#endif + stream->socket_fd = -1; return -1; } - - if (connect(stream->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - fossil_set_last_error("Connection to the server failed"); - return -1; + + // Special handling for UDP: connect is optional + if (stream->protocol == FOSSIL_PROTO_UDP || stream->protocol == FOSSIL_PROTO_DNS || stream->protocol == FOSSIL_PROTO_NTP) { + // UDP "connect" sets a default peer address; no handshake + if (connect(stream->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + fossil_set_last_error("UDP 'connect' failed — is remote peer reachable?"); + return -1; + } + } else { + // TCP and application-layer protocols require real connection + if (connect(stream->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + fossil_set_last_error("TCP connect() failed"); + return -1; + } } - + stream->is_connected = 1; + stream->remote_addr = addr; + time(&stream->last_activity); // track timestamp of connection return 0; } @@ -244,34 +278,84 @@ int fossil_nstream_listen(fossil_nstream_t *stream, const char *host, int port) fossil_set_last_error("Stream is NULL"); return -1; } - + + // Ensure protocol supports listening + switch (stream->protocol) { + case FOSSIL_PROTO_TCP: + case FOSSIL_PROTO_HTTP: + case FOSSIL_PROTO_HTTPS: + case FOSSIL_PROTO_FTP: + case FOSSIL_PROTO_SSH: + case FOSSIL_PROTO_SMTP: + case FOSSIL_PROTO_POP3: + case FOSSIL_PROTO_IMAP: + case FOSSIL_PROTO_LDAP: + case FOSSIL_PROTO_MQTT: + // All valid stream-based protocols + break; + + case FOSSIL_PROTO_UDP: + case FOSSIL_PROTO_DNS: + case FOSSIL_PROTO_NTP: + // Datagram protocols: allow bind() but not listen() + break; + + default: + fossil_set_last_error("Protocol not valid for listening"); + return -1; + } + stream->socket_fd = fossil_create_socket(stream->protocol); if (stream->socket_fd == (socket_t)-1) { - return -1; + return -1; // Error already set by fossil_create_socket } - + int opt = 1; if (setsockopt(stream->socket_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(opt)) < 0) { - fossil_set_last_error("Failed to set socket options"); + fossil_set_last_error("Failed to set SO_REUSEADDR"); return -1; } - + struct sockaddr_in addr = {0}; addr.sin_family = AF_INET; addr.sin_port = htons(port); - addr.sin_addr.s_addr = (host == NULL) ? INADDR_ANY : inet_addr(host); - + + if (!host || strcmp(host, "0.0.0.0") == 0) { + addr.sin_addr.s_addr = INADDR_ANY; + } else { + if (inet_pton(AF_INET, host, &addr.sin_addr) <= 0) { + fossil_set_last_error("Invalid listen address"); + return -1; + } + } + if (bind(stream->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { fossil_set_last_error("Bind failed"); return -1; } - - if (listen(stream->socket_fd, SOMAXCONN) < 0) { - fossil_set_last_error("Listen failed"); - return -1; + + // Only call listen() on stream-based protocols + if (stream->protocol == FOSSIL_PROTO_TCP || + stream->protocol == FOSSIL_PROTO_HTTP || + stream->protocol == FOSSIL_PROTO_HTTPS || + stream->protocol == FOSSIL_PROTO_FTP || + stream->protocol == FOSSIL_PROTO_SSH || + stream->protocol == FOSSIL_PROTO_SMTP || + stream->protocol == FOSSIL_PROTO_POP3 || + stream->protocol == FOSSIL_PROTO_IMAP || + stream->protocol == FOSSIL_PROTO_LDAP || + stream->protocol == FOSSIL_PROTO_MQTT) { + + if (listen(stream->socket_fd, SOMAXCONN) < 0) { + fossil_set_last_error("Listen failed"); + return -1; + } } - + stream->is_server = 1; + time(&stream->created_at); + stream->local_addr = addr; + return 0; } From 87d1ad35db5c2f3290e412162a3eaf5958840780 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sat, 19 Jul 2025 22:45:17 -0700 Subject: [PATCH 04/33] Update Dockerfile.debian --- .github/ciimage/Dockerfile.debian | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/ciimage/Dockerfile.debian b/.github/ciimage/Dockerfile.debian index bd9c16f..640587f 100644 --- a/.github/ciimage/Dockerfile.debian +++ b/.github/ciimage/Dockerfile.debian @@ -1,5 +1,5 @@ -# Use a specific Debian base image -FROM debian:buster +# Use a specific Debian Bookworm base image +FROM debian:bookworm # Set environment variables to avoid interaction ENV DEBIAN_FRONTEND=noninteractive \ @@ -7,28 +7,30 @@ ENV DEBIAN_FRONTEND=noninteractive \ # Install system dependencies and clean up RUN apt-get update && \ - apt-get install -y \ + apt-get install -y --no-install-recommends \ build-essential \ clang \ gcc \ g++ \ gdb \ llvm \ - libstdc++-8-dev \ + libstdc++-12-dev \ wget \ python3 \ + python3-full \ python3-pip \ - git && \ + git \ + ca-certificates && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* -# Install Meson and Ninja -RUN python3 -m pip install --no-cache-dir meson ninja==1.10.2 +# Install Meson and Ninja using pip +RUN python3 -m pip install --no-cache-dir meson==1.3.0 ninja==1.10.2 --break-system-packages # Set environment variables -ENV CC=/usr/bin/clang -ENV CXX=/usr/bin/clang++ -ENV LD_LIBRARY_PATH=/usr/local/lib +ENV CC=clang \ + CXX=clang++ \ + LD_LIBRARY_PATH=/usr/local/lib # Set working directory WORKDIR /workspace From 849a85f1d3490925ef4c0878336017c8d5c16456 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sat, 19 Jul 2025 22:46:51 -0700 Subject: [PATCH 05/33] Update network.c --- code/logic/network.c | 196 +++++++++++++------------------------------ 1 file changed, 56 insertions(+), 140 deletions(-) diff --git a/code/logic/network.c b/code/logic/network.c index 6fa1177..e090d03 100644 --- a/code/logic/network.c +++ b/code/logic/network.c @@ -148,128 +148,94 @@ fossil_nstream_t *fossil_nstream_create(const char *protocol_flag, const char *c fossil_set_last_error("Socket system initialization failed"); return NULL; } - + if (!protocol_flag || !client_type_flag) { fossil_set_last_error("Invalid protocol or client type flag"); return NULL; } - + fossil_protocol_t protocol = fossil_protocol_from_string(protocol_flag); fossil_client_type_t client_type = fossil_client_type_from_string(client_type_flag); - + if (protocol == FOSSIL_PROTO_UNKNOWN) { fossil_set_last_error("Unsupported protocol"); return NULL; } - + if (client_type == FOSSIL_CLIENT_UNKNOWN) { fossil_set_last_error("Unsupported client type"); return NULL; } - - // Validate protocol-specific constraints - switch (protocol) { - case FOSSIL_PROTO_ICMP: - case FOSSIL_PROTO_RAW: - #ifndef _WIN32 - if (geteuid() != 0) { - fossil_set_last_error("ICMP/RAW sockets require root privileges"); - return NULL; - } - #endif - break; - case FOSSIL_PROTO_HTTP: - case FOSSIL_PROTO_HTTPS: - case FOSSIL_PROTO_FTP: - case FOSSIL_PROTO_SSH: - case FOSSIL_PROTO_SMTP: - case FOSSIL_PROTO_POP3: - case FOSSIL_PROTO_IMAP: - case FOSSIL_PROTO_LDAP: - case FOSSIL_PROTO_MQTT: - // These are application-layer protocols; you may optionally enforce TCP - if (protocol != FOSSIL_PROTO_TCP && protocol != FOSSIL_PROTO_HTTPS) { - fossil_set_last_error("Application protocols require TCP/SSL"); - return NULL; - } - break; - case FOSSIL_PROTO_DNS: - case FOSSIL_PROTO_NTP: - // These typically use UDP - break; - default: - break; - } - + fossil_nstream_t *stream = (fossil_nstream_t *)calloc(1, sizeof(fossil_nstream_t)); if (!stream) { fossil_set_last_error("Memory allocation failed"); return NULL; } - + stream->protocol = protocol; stream->client_type = client_type; snprintf(stream->protocol_flag, sizeof(stream->protocol_flag), "%s", protocol_flag); snprintf(stream->client_type_flag, sizeof(stream->client_type_flag), "%s", client_type_flag); stream->socket_fd = -1; - return stream; } +static socket_t fossil_create_socket(fossil_protocol_t proto) { + int type = SOCK_STREAM; + int proto_num = IPPROTO_TCP; + + switch (proto) { + case FOSSIL_PROTO_TCP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; + case FOSSIL_PROTO_UDP: type = SOCK_DGRAM; proto_num = IPPROTO_UDP; break; + case FOSSIL_PROTO_RAW: type = SOCK_RAW; proto_num = IPPROTO_RAW; break; + case FOSSIL_PROTO_ICMP: type = SOCK_RAW; proto_num = IPPROTO_ICMP; break; + case FOSSIL_PROTO_SCTP: type = SOCK_STREAM; proto_num = IPPROTO_SCTP; break; + case FOSSIL_PROTO_HTTP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; + case FOSSIL_PROTO_HTTPS: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; + case FOSSIL_PROTO_FTP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; + case FOSSIL_PROTO_SSH: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; + case FOSSIL_PROTO_DNS: type = SOCK_DGRAM; proto_num = IPPROTO_UDP; break; + case FOSSIL_PROTO_NTP: type = SOCK_DGRAM; proto_num = IPPROTO_UDP; break; + case FOSSIL_PROTO_SMTP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; + case FOSSIL_PROTO_POP3: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; + case FOSSIL_PROTO_IMAP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; + case FOSSIL_PROTO_LDAP: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; + case FOSSIL_PROTO_MQTT: type = SOCK_STREAM; proto_num = IPPROTO_TCP; break; + default: + fossil_set_last_error("Unsupported protocol for socket creation"); + return -1; + } + + return socket(AF_INET, type, proto_num); +} + int fossil_nstream_connect(fossil_nstream_t *stream, const char *host, int port) { if (!stream) { fossil_set_last_error("Stream is NULL"); return -1; } - - // Validate protocol connect support - switch (stream->protocol) { - case FOSSIL_PROTO_ICMP: - case FOSSIL_PROTO_RAW: - fossil_set_last_error("Protocol does not support connect() in traditional sense"); - return -1; - default: - break; // Proceed for connect-capable protocols - } - + stream->socket_fd = fossil_create_socket(stream->protocol); if ((int)stream->socket_fd < 0) { - return -1; // fossil_create_socket() already sets error + return -1; } - + struct sockaddr_in addr = {0}; addr.sin_family = AF_INET; addr.sin_port = htons(port); - + if (inet_pton(AF_INET, host, &addr.sin_addr) <= 0) { fossil_set_last_error("Invalid address or address not supported"); -#ifdef _WIN32 - closesocket(stream->socket_fd); -#else - close(stream->socket_fd); -#endif - stream->socket_fd = -1; return -1; } - - // Special handling for UDP: connect is optional - if (stream->protocol == FOSSIL_PROTO_UDP || stream->protocol == FOSSIL_PROTO_DNS || stream->protocol == FOSSIL_PROTO_NTP) { - // UDP "connect" sets a default peer address; no handshake - if (connect(stream->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - fossil_set_last_error("UDP 'connect' failed — is remote peer reachable?"); - return -1; - } - } else { - // TCP and application-layer protocols require real connection - if (connect(stream->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - fossil_set_last_error("TCP connect() failed"); - return -1; - } + + if (connect(stream->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + fossil_set_last_error("Connection to the server failed"); + return -1; } - + stream->is_connected = 1; - stream->remote_addr = addr; - time(&stream->last_activity); // track timestamp of connection return 0; } @@ -278,84 +244,34 @@ int fossil_nstream_listen(fossil_nstream_t *stream, const char *host, int port) fossil_set_last_error("Stream is NULL"); return -1; } - - // Ensure protocol supports listening - switch (stream->protocol) { - case FOSSIL_PROTO_TCP: - case FOSSIL_PROTO_HTTP: - case FOSSIL_PROTO_HTTPS: - case FOSSIL_PROTO_FTP: - case FOSSIL_PROTO_SSH: - case FOSSIL_PROTO_SMTP: - case FOSSIL_PROTO_POP3: - case FOSSIL_PROTO_IMAP: - case FOSSIL_PROTO_LDAP: - case FOSSIL_PROTO_MQTT: - // All valid stream-based protocols - break; - - case FOSSIL_PROTO_UDP: - case FOSSIL_PROTO_DNS: - case FOSSIL_PROTO_NTP: - // Datagram protocols: allow bind() but not listen() - break; - - default: - fossil_set_last_error("Protocol not valid for listening"); - return -1; - } - + stream->socket_fd = fossil_create_socket(stream->protocol); if (stream->socket_fd == (socket_t)-1) { - return -1; // Error already set by fossil_create_socket + return -1; } - + int opt = 1; if (setsockopt(stream->socket_fd, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(opt)) < 0) { - fossil_set_last_error("Failed to set SO_REUSEADDR"); + fossil_set_last_error("Failed to set socket options"); return -1; } - + struct sockaddr_in addr = {0}; addr.sin_family = AF_INET; addr.sin_port = htons(port); - - if (!host || strcmp(host, "0.0.0.0") == 0) { - addr.sin_addr.s_addr = INADDR_ANY; - } else { - if (inet_pton(AF_INET, host, &addr.sin_addr) <= 0) { - fossil_set_last_error("Invalid listen address"); - return -1; - } - } - + addr.sin_addr.s_addr = (host == NULL) ? INADDR_ANY : inet_addr(host); + if (bind(stream->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { fossil_set_last_error("Bind failed"); return -1; } - - // Only call listen() on stream-based protocols - if (stream->protocol == FOSSIL_PROTO_TCP || - stream->protocol == FOSSIL_PROTO_HTTP || - stream->protocol == FOSSIL_PROTO_HTTPS || - stream->protocol == FOSSIL_PROTO_FTP || - stream->protocol == FOSSIL_PROTO_SSH || - stream->protocol == FOSSIL_PROTO_SMTP || - stream->protocol == FOSSIL_PROTO_POP3 || - stream->protocol == FOSSIL_PROTO_IMAP || - stream->protocol == FOSSIL_PROTO_LDAP || - stream->protocol == FOSSIL_PROTO_MQTT) { - - if (listen(stream->socket_fd, SOMAXCONN) < 0) { - fossil_set_last_error("Listen failed"); - return -1; - } + + if (listen(stream->socket_fd, SOMAXCONN) < 0) { + fossil_set_last_error("Listen failed"); + return -1; } - + stream->is_server = 1; - time(&stream->created_at); - stream->local_addr = addr; - return 0; } From bac6865e00216f0d2a5a197010d8834374f4d5b5 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 06:52:26 -0700 Subject: [PATCH 06/33] Update soap.h --- code/logic/fossil/io/soap.h | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/code/logic/fossil/io/soap.h b/code/logic/fossil/io/soap.h index ed4ba45..4d9e6bd 100644 --- a/code/logic/fossil/io/soap.h +++ b/code/logic/fossil/io/soap.h @@ -58,6 +58,46 @@ void fossil_io_soap_clear_custom_filters(void); */ const char *fossil_io_soap_detect_tone(const char *text); +/** + * @brief Detect potential misinformation, logical fallacies, or fake claims in a sentence. + * + * @param text The input text. + * @return A dynamically allocated report string describing potential issues (must be freed by the caller). + */ +char *fossil_io_soap_detect_falsehood(const char *text); + +/** + * @brief Score the factual reliability of the input statement. + * + * @param text The input text. + * @return A float between 0.0 (untrustworthy) and 1.0 (highly reliable). + */ +float fossil_io_soap_score_reliability(const char *text); + +/** + * @brief Detect biased or emotionally charged language. + * + * @param text The input text. + * @return A dynamically allocated summary of bias indicators (must be freed by the caller). + */ +char *fossil_io_soap_detect_bias(const char *text); + +/** + * @brief Normalize the tone of the text to a more neutral or factual expression. + * + * @param text The input text. + * @return A dynamically allocated, neutralized string (must be freed by the caller). + */ +char *fossil_io_soap_neutralize(const char *text); + +/** + * @brief Detect whether a sentence is meme-based or contains low-information content. + * + * @param text The input text. + * @return 1 if detected, 0 otherwise. + */ +int fossil_io_soap_is_low_information(const char *text); + #ifdef __cplusplus } From b275aa132b42beb0ed8d7b8833b572c4026263fc Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 07:50:46 -0700 Subject: [PATCH 07/33] Update soap.h --- code/logic/fossil/io/soap.h | 114 +++++++++++++++++++++++++++++------- 1 file changed, 94 insertions(+), 20 deletions(-) diff --git a/code/logic/fossil/io/soap.h b/code/logic/fossil/io/soap.h index 4d9e6bd..043a09b 100644 --- a/code/logic/fossil/io/soap.h +++ b/code/logic/fossil/io/soap.h @@ -59,44 +59,118 @@ void fossil_io_soap_clear_custom_filters(void); const char *fossil_io_soap_detect_tone(const char *text); /** - * @brief Detect potential misinformation, logical fallacies, or fake claims in a sentence. + * @brief Analyze sentence structure and flag grammatical inconsistencies. * - * @param text The input text. - * @return A dynamically allocated report string describing potential issues (must be freed by the caller). + * @param text Input string to analyze. + * @return 0 if grammar is clean, non-zero otherwise. */ -char *fossil_io_soap_detect_falsehood(const char *text); +int fossil_io_soap_check_grammar(const char *text); /** - * @brief Score the factual reliability of the input statement. + * @brief Normalize all informal or abbreviated expressions. * - * @param text The input text. - * @return A float between 0.0 (untrustworthy) and 1.0 (highly reliable). + * @param text Input string to normalize. + * @return A newly allocated normalized string (caller must free). */ -float fossil_io_soap_score_reliability(const char *text); +char *fossil_io_soap_normalize(const char *text); /** - * @brief Detect biased or emotionally charged language. + * @brief Generate a hashed audit trail of all detected issues in input. * - * @param text The input text. - * @return A dynamically allocated summary of bias indicators (must be freed by the caller). + * @param text Input string to audit. + * @return A JSON-formatted string with all flags and replacements, signed (caller must free). */ -char *fossil_io_soap_detect_bias(const char *text); +char *fossil_io_soap_generate_audit_block(const char *text); /** - * @brief Normalize the tone of the text to a more neutral or factual expression. + * @brief Return a digest summary of all transformations made to a string. * - * @param text The input text. - * @return A dynamically allocated, neutralized string (must be freed by the caller). + * @param original Original input. + * @param transformed Transformed result. + * @return A cryptographic hash or short audit ID. */ -char *fossil_io_soap_neutralize(const char *text); +char *fossil_io_soap_diff_digest(const char *original, const char *transformed); /** - * @brief Detect whether a sentence is meme-based or contains low-information content. + * @brief Generate a hashed audit trail of all detected issues in input. * - * @param text The input text. - * @return 1 if detected, 0 otherwise. + * @param text Input string to audit. + * @return A JSON-formatted string with all flags and replacements, signed (caller must free). + */ +char *fossil_io_soap_generate_audit_block(const char *text); + +/** + * @brief Return a digest summary of all transformations made to a string. + * + * @param original Original input. + * @param transformed Transformed result. + * @return A cryptographic hash or short audit ID. + */ +char *fossil_io_soap_diff_digest(const char *original, const char *transformed); + +/** + * @brief Detect sarcasm, satire, or irony in a phrase. + * + * @param text Input string. + * @return 1 if detected, 0 if not. + */ +int fossil_io_soap_detect_sarcasm(const char *text); + +/** + * @brief Determine if the tone of the input is informative, persuasive, emotional, etc. + * + * @param text Input text. + * @return A short string such as "informative", "emotional", "neutral". + */ +const char *fossil_io_soap_detect_intent(const char *text); + +/** + * @brief Flag potentially offensive, biased, or manipulative phrases. + * + * @param text Input string. + * @return A sanitized copy of the input with flagged content marked (caller must free). + */ +char *fossil_io_soap_flag_ethics(const char *text); + +/** + * @brief Return a list of ethical categories the input violates. + * + * @param text Input string. + * @return JSON or CSV string of category names (caller must free). + */ +char *fossil_io_soap_list_ethics_flags(const char *text); + +/** + * @brief Load SOAP behavior extensions from a `.fish` or `.jellyfish` mindset file. + * + * @param filename Path to file to load. + * @return 0 on success, non-zero on error. + */ +int fossil_io_soap_load_mindset_file(const char *filename); + +/** + * @brief Serialize SOAP's current state into a `.jellyfish` compatible format. + * + * @return A `.jellyfish` format string with active filters, models, and thresholds (caller must free). + */ +char *fossil_io_soap_export_mindset(void); + +/** + * @brief Score the semantic similarity between two phrases. + * + * @param a First input. + * @param b Second input. + * @return A similarity score from 0.0 to 1.0. + */ +float fossil_io_soap_semantic_similarity(const char *a, const char *b); + +/** + * @brief Determine if the given input matches a known propaganda or meme pattern. + * + * @param text Input to check. + * @return 1 if matched, 0 otherwise. */ -int fossil_io_soap_is_low_information(const char *text); +int fossil_io_soap_detect_memetic_pattern(const char *text); #ifdef __cplusplus } From 1fcea0f3987f4a481151b6bb02c0a0db94770be5 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 08:00:31 -0700 Subject: [PATCH 08/33] Update soap.c --- code/logic/soap.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) diff --git a/code/logic/soap.c b/code/logic/soap.c index 32fce3d..85e5d6a 100644 --- a/code/logic/soap.c +++ b/code/logic/soap.c @@ -18,6 +18,7 @@ #include #include +#define FOSSIL_JELLYFISH_HASH_SIZE 16 #define MAX_CUSTOM_FILTERS 64 /** Lookup table for rot-brain words and their suggested replacements */ @@ -383,3 +384,171 @@ const char *fossil_io_soap_detect_tone(const char *text) { return "casual"; } + +int fossil_io_soap_check_grammar(const char *text) { + if (!text) return -1; + for (size_t i = 0; FOSSIL_SOAP_GRAMMAR_SUGGESTIONS[i].incorrect; i++) { + if (custom_strcasestr(text, FOSSIL_SOAP_GRAMMAR_SUGGESTIONS[i].incorrect)) { + return 1; // Grammar issue found + } + } + return 0; +} + +char *fossil_io_soap_normalize(const char *text) { + if (!text) return NULL; + + char *normalized = strdup(text); // Create modifiable copy + if (!normalized) return NULL; + + for (size_t i = 0; FOSSIL_SOAP_SUGGESTIONS[i].bad; i++) { + const char *bad = FOSSIL_SOAP_SUGGESTIONS[i].bad; + const char *fix = FOSSIL_SOAP_SUGGESTIONS[i].suggested; + const char *ptr; + while ((ptr = custom_strcasestr(normalized, bad))) { + size_t prefix_len = ptr - normalized; + size_t new_len = strlen(normalized) - strlen(bad) + strlen(fix) + 1; + char *temp = malloc(new_len); + if (!temp) break; + snprintf(temp, new_len, "%.*s%s%s", + (int)prefix_len, normalized, fix, ptr + strlen(bad)); + free(normalized); + normalized = temp; + } + } + + return normalized; +} + +char *fossil_io_soap_generate_audit_block(const char *text) { + if (!text) return NULL; + + char *sanitized = fossil_io_soap_sanitize(text); + if (!sanitized) return NULL; + + // Compute Jellyfish-style hash + uint8_t hash_out[FOSSIL_JELLYFISH_HASH_SIZE]; + fossil_jellyfish_hash(text, sanitized, hash_out); + + // Convert hash to hex string + char hash_hex[FOSSIL_JELLYFISH_HASH_SIZE * 2 + 1] = {0}; + for (size_t i = 0; i < FOSSIL_JELLYFISH_HASH_SIZE; ++i) { + sprintf(hash_hex + i * 2, "%02x", hash_out[i]); + } + + // Allocate JSON audit block + size_t needed = strlen(text) + strlen(sanitized) + strlen(hash_hex) + 64; + char *audit_block = malloc(needed); + if (!audit_block) { + free(sanitized); + return NULL; + } + + snprintf(audit_block, needed, + "{ \"original\": \"%s\", \"sanitized\": \"%s\", \"hash\": \"%s\" }", + text, sanitized, hash_hex); + + free(sanitized); + return audit_block; +} + +char *fossil_io_soap_diff_digest(const char *original, const char *transformed) { + if (!original || !transformed) return NULL; + + size_t size = strlen(original) + strlen(transformed) + 2; + char *combo = malloc(size); + if (!combo) return NULL; + + snprintf(combo, size, "%s|%s", original, transformed); + + char *digest = fossil_io_cstring_dup(fossil_hash_string(combo)); + free(combo); + return digest; +} + +int fossil_io_soap_detect_sarcasm(const char *text) { + if (!text) return 0; + for (size_t i = 0; SARCASTIC_PHRASES[i]; i++) { + if (custom_strcasestr(text, SARCASTIC_PHRASES[i])) return 1; + } + return 0; +} + +const char *fossil_io_soap_detect_intent(const char *text) { + if (!text) return "unknown"; + if (fossil_io_soap_detect_sarcasm(text)) return "sarcastic"; + if (custom_strcasestr(text, "please") || custom_strcasestr(text, "I would like")) + return "formal"; + if (strchr(text, '!') != NULL) return "emotional"; + return "neutral"; +} + +char *fossil_io_soap_flag_ethics(const char *text) { + if (!text) return NULL; + + // Simulate simple filter + const char *bad_words[] = {"stupid", "idiot", "hate", "kill", NULL}; + + char *flagged = strdup(text); + if (!flagged) return NULL; + + for (size_t i = 0; bad_words[i]; i++) { + const char *ptr; + while ((ptr = custom_strcasestr(flagged, bad_words[i]))) { + size_t offset = ptr - flagged; + memset(flagged + offset, '*', strlen(bad_words[i])); + } + } + return flagged; +} + +char *fossil_io_soap_list_ethics_flags(const char *text) { + if (!text) return NULL; + + const char *categories[] = {"violence", "hate-speech", "bias", NULL}; + const char *keywords[] = {"kill", "hate", "stupid", NULL}; + + char buffer[256] = {0}; + for (size_t i = 0; keywords[i]; i++) { + if (custom_strcasestr(text, keywords[i])) { + strcat(buffer, categories[i]); + strcat(buffer, ","); + } + } + + if (strlen(buffer) > 0) buffer[strlen(buffer) - 1] = '\0'; // Remove last comma + return fossil_io_cstring_dup(buffer); +} + +int fossil_io_soap_load_mindset_file(const char *filename) { + FILE *f = fopen(filename, "r"); + if (!f) return -1; + + char line[256]; + while (fgets(line, sizeof(line), f)) { + if (strncmp(line, "filter:", 7) == 0) { + char *phrase = line + 7; + while (*phrase == ' ') phrase++; + phrase[strcspn(phrase, "\r\n")] = 0; + fossil_io_soap_add_custom_filter(phrase); + } + } + + fclose(f); + return 0; +} + +char *fossil_io_soap_export_mindset(void) { + char *output = malloc(2048); + if (!output) return NULL; + strcpy(output, "#mindset('soap') {\n"); + + for (size_t i = 0; i < MAX_CUSTOM_FILTERS && custom_filters[i]; i++) { + strcat(output, " filter: "); + strcat(output, custom_filters[i]); + strcat(output, "\n"); + } + + strcat(output, "}\n"); + return output; +} From 84acdd694351989a5a12474a56f8157a71911dd2 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 08:06:51 -0700 Subject: [PATCH 09/33] Update soap.c --- code/logic/soap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/code/logic/soap.c b/code/logic/soap.c index 85e5d6a..c0e45e8 100644 --- a/code/logic/soap.c +++ b/code/logic/soap.c @@ -12,6 +12,7 @@ * ----------------------------------------------------------------------------- */ #include "fossil/io/soap.h" +#include "fossil/io/cstring.h" #include #include #include From d464afe2fc9afb481b8a85e9a647c0a822b9eea2 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 08:28:11 -0700 Subject: [PATCH 10/33] Update soap.c --- code/logic/soap.c | 70 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/code/logic/soap.c b/code/logic/soap.c index c0e45e8..5184227 100644 --- a/code/logic/soap.c +++ b/code/logic/soap.c @@ -19,7 +19,6 @@ #include #include -#define FOSSIL_JELLYFISH_HASH_SIZE 16 #define MAX_CUSTOM_FILTERS 64 /** Lookup table for rot-brain words and their suggested replacements */ @@ -131,6 +130,55 @@ static const char *SKIP_WORDS[] = { NULL // Sentinel to mark the end }; +#define FNV_PRIME 0x01000193 +#define FNV_BASIS 0x811c9dc5 + +void fossil_io_soap_jellyfish_hash(const char *input, const char *output, uint8_t *hash_out) { + uint32_t hash = FNV_BASIS; + size_t in_len = strlen(input); + size_t out_len = strlen(output); + + // Mix lengths + hash ^= in_len; + hash *= FNV_PRIME; + hash ^= out_len; + hash *= FNV_PRIME; + + // Mix input string + for (size_t i = 0; i < in_len; ++i) { + hash ^= (uint8_t)input[i]; + hash *= FNV_PRIME; + hash ^= (hash >> 5); + } + + // Mix output string + for (size_t i = 0; i < out_len; ++i) { + hash ^= (uint8_t)output[i]; + hash *= FNV_PRIME; + hash ^= (hash >> 5); + } + + // Final avalanche + hash ^= (hash << 7); + hash ^= (hash >> 3); + + // Expand to fixed size + uint32_t h = hash; + for (size_t i = 0; i < FOSSIL_JELLYFISH_HASH_SIZE; ++i) { + h ^= (h >> 13); + h *= FNV_PRIME; + h ^= (h << 11); + hash_out[i] = (uint8_t)((h >> (8 * (i % 4))) & 0xFF); + } +} + +static void hash_to_hex(const uint8_t *hash, size_t len, char *out_hex) { + for (size_t i = 0; i < len; ++i) { + sprintf(out_hex + i * 2, "%02x", hash[i]); + } + out_hex[len * 2] = '\0'; +} + /** * @brief Convert leetspeak to normal letters. */ @@ -427,25 +475,19 @@ char *fossil_io_soap_generate_audit_block(const char *text) { char *sanitized = fossil_io_soap_sanitize(text); if (!sanitized) return NULL; - // Compute Jellyfish-style hash - uint8_t hash_out[FOSSIL_JELLYFISH_HASH_SIZE]; - fossil_jellyfish_hash(text, sanitized, hash_out); + uint8_t hash[FOSSIL_JELLYFISH_HASH_SIZE]; + char hash_hex[FOSSIL_JELLYFISH_HASH_SIZE * 2 + 1]; - // Convert hash to hex string - char hash_hex[FOSSIL_JELLYFISH_HASH_SIZE * 2 + 1] = {0}; - for (size_t i = 0; i < FOSSIL_JELLYFISH_HASH_SIZE; ++i) { - sprintf(hash_hex + i * 2, "%02x", hash_out[i]); - } + fossil_io_soap_jellyfish_hash(text, sanitized, hash); + hash_to_hex(hash, FOSSIL_JELLYFISH_HASH_SIZE, hash_hex); - // Allocate JSON audit block - size_t needed = strlen(text) + strlen(sanitized) + strlen(hash_hex) + 64; - char *audit_block = malloc(needed); + char *audit_block = malloc(1024); if (!audit_block) { free(sanitized); return NULL; } - snprintf(audit_block, needed, + snprintf(audit_block, 1024, "{ \"original\": \"%s\", \"sanitized\": \"%s\", \"hash\": \"%s\" }", text, sanitized, hash_hex); @@ -490,7 +532,7 @@ char *fossil_io_soap_flag_ethics(const char *text) { // Simulate simple filter const char *bad_words[] = {"stupid", "idiot", "hate", "kill", NULL}; - char *flagged = strdup(text); + char *flagged = fossil_io_cstring_dup(text); if (!flagged) return NULL; for (size_t i = 0; bad_words[i]; i++) { From c3ee77ace2726eae48e11f0ea09195d036f9f50e Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 08:34:57 -0700 Subject: [PATCH 11/33] Update soap.c --- code/logic/soap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/code/logic/soap.c b/code/logic/soap.c index 5184227..0b859de 100644 --- a/code/logic/soap.c +++ b/code/logic/soap.c @@ -19,6 +19,7 @@ #include #include +#define FOSSIL_JELLYFISH_HASH_SIZE 16 #define MAX_CUSTOM_FILTERS 64 /** Lookup table for rot-brain words and their suggested replacements */ From 13fc3579953702d8fa5d43b9fdff3e1521693eb0 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 08:39:24 -0700 Subject: [PATCH 12/33] Update soap.h --- code/logic/fossil/io/soap.h | 98 +++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 54 deletions(-) diff --git a/code/logic/fossil/io/soap.h b/code/logic/fossil/io/soap.h index 043a09b..2b44d75 100644 --- a/code/logic/fossil/io/soap.h +++ b/code/logic/fossil/io/soap.h @@ -75,102 +75,92 @@ int fossil_io_soap_check_grammar(const char *text); char *fossil_io_soap_normalize(const char *text); /** - * @brief Generate a hashed audit trail of all detected issues in input. + * @brief Analyze the sentiment of the input text. * - * @param text Input string to audit. - * @return A JSON-formatted string with all flags and replacements, signed (caller must free). + * @param text The input string. + * @return A string like "positive", "negative", or "neutral". */ -char *fossil_io_soap_generate_audit_block(const char *text); +const char *fossil_io_soap_detect_sentiment(const char *text); /** - * @brief Return a digest summary of all transformations made to a string. + * @brief Detect potential hate speech or harmful content. * - * @param original Original input. - * @param transformed Transformed result. - * @return A cryptographic hash or short audit ID. + * @param text The input string. + * @return 1 if harmful content is detected, 0 otherwise. */ -char *fossil_io_soap_diff_digest(const char *original, const char *transformed); +int fossil_io_soap_detect_harmful_content(const char *text); /** - * @brief Generate a hashed audit trail of all detected issues in input. + * @brief Normalize internet slang or leetspeak in input text. * - * @param text Input string to audit. - * @return A JSON-formatted string with all flags and replacements, signed (caller must free). + * @param text The input string. + * @return A dynamically allocated cleaned-up version (must be freed). */ -char *fossil_io_soap_generate_audit_block(const char *text); +char *fossil_io_soap_normalize_slang(const char *text); /** - * @brief Return a digest summary of all transformations made to a string. + * @brief Apply a grammar correction pass over the input text. * - * @param original Original input. - * @param transformed Transformed result. - * @return A cryptographic hash or short audit ID. - */ -char *fossil_io_soap_diff_digest(const char *original, const char *transformed); - -/** - * @brief Detect sarcasm, satire, or irony in a phrase. - * - * @param text Input string. - * @return 1 if detected, 0 if not. + * @param text The input text. + * @return A dynamically allocated corrected string (must be freed). */ -int fossil_io_soap_detect_sarcasm(const char *text); +char *fossil_io_soap_correct_grammar(const char *text); /** - * @brief Determine if the tone of the input is informative, persuasive, emotional, etc. + * @brief Evaluate the clarity and readability level of the input text. * - * @param text Input text. - * @return A short string such as "informative", "emotional", "neutral". + * @param text The input string. + * @return Readability score (e.g., Flesch-Kincaid grade level). */ -const char *fossil_io_soap_detect_intent(const char *text); +float fossil_io_soap_evaluate_readability(const char *text); /** - * @brief Flag potentially offensive, biased, or manipulative phrases. + * @brief Detect exaggeration or hyperbolic language in a sentence. * - * @param text Input string. - * @return A sanitized copy of the input with flagged content marked (caller must free). + * @param text The input string. + * @return 1 if exaggeration detected, 0 otherwise. */ -char *fossil_io_soap_flag_ethics(const char *text); +int fossil_io_soap_detect_exaggeration(const char *text); /** - * @brief Return a list of ethical categories the input violates. + * @brief Replace offensive language with neutral alternatives. * - * @param text Input string. - * @return JSON or CSV string of category names (caller must free). + * @param text The input string. + * @return A dynamically allocated sanitized string (must be freed). */ -char *fossil_io_soap_list_ethics_flags(const char *text); +char *fossil_io_soap_filter_offensive(const char *text); /** - * @brief Load SOAP behavior extensions from a `.fish` or `.jellyfish` mindset file. + * @brief Check if input contains clickbait-style language. * - * @param filename Path to file to load. - * @return 0 on success, non-zero on error. + * @param text The input string. + * @return 1 if clickbait is detected, 0 otherwise. */ -int fossil_io_soap_load_mindset_file(const char *filename); +int fossil_io_soap_detect_clickbait(const char *text); /** - * @brief Serialize SOAP's current state into a `.jellyfish` compatible format. + * @brief Detect logical fallacies or flawed reasoning in a sentence. * - * @return A `.jellyfish` format string with active filters, models, and thresholds (caller must free). + * @param text The input string. + * @return A string describing the detected fallacy, or NULL if none found. */ -char *fossil_io_soap_export_mindset(void); +const char *fossil_io_soap_detect_fallacy(const char *text); /** - * @brief Score the semantic similarity between two phrases. + * @brief Summarize the key idea in the input sentence. * - * @param a First input. - * @param b Second input. - * @return A similarity score from 0.0 to 1.0. + * @param text The input string. + * @return A dynamically allocated short summary (must be freed). */ -float fossil_io_soap_semantic_similarity(const char *a, const char *b); +char *fossil_io_soap_summarize(const char *text); /** - * @brief Determine if the given input matches a known propaganda or meme pattern. + * @brief Score how polite or impolite the tone of the input is. * - * @param text Input to check. - * @return 1 if matched, 0 otherwise. + * @param text The input string. + * @return A score from 0.0 (rude) to 1.0 (very polite). */ -int fossil_io_soap_detect_memetic_pattern(const char *text); +float fossil_io_soap_politeness_score(const char *text); #ifdef __cplusplus } From cdfcf622a9667a974ecc66652c2baa8deea38ca0 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 08:44:46 -0700 Subject: [PATCH 13/33] Update soap.c --- code/logic/soap.c | 234 +++++++++++++++++++--------------------------- 1 file changed, 96 insertions(+), 138 deletions(-) diff --git a/code/logic/soap.c b/code/logic/soap.c index 0b859de..6b78b6b 100644 --- a/code/logic/soap.c +++ b/code/logic/soap.c @@ -19,7 +19,6 @@ #include #include -#define FOSSIL_JELLYFISH_HASH_SIZE 16 #define MAX_CUSTOM_FILTERS 64 /** Lookup table for rot-brain words and their suggested replacements */ @@ -131,48 +130,6 @@ static const char *SKIP_WORDS[] = { NULL // Sentinel to mark the end }; -#define FNV_PRIME 0x01000193 -#define FNV_BASIS 0x811c9dc5 - -void fossil_io_soap_jellyfish_hash(const char *input, const char *output, uint8_t *hash_out) { - uint32_t hash = FNV_BASIS; - size_t in_len = strlen(input); - size_t out_len = strlen(output); - - // Mix lengths - hash ^= in_len; - hash *= FNV_PRIME; - hash ^= out_len; - hash *= FNV_PRIME; - - // Mix input string - for (size_t i = 0; i < in_len; ++i) { - hash ^= (uint8_t)input[i]; - hash *= FNV_PRIME; - hash ^= (hash >> 5); - } - - // Mix output string - for (size_t i = 0; i < out_len; ++i) { - hash ^= (uint8_t)output[i]; - hash *= FNV_PRIME; - hash ^= (hash >> 5); - } - - // Final avalanche - hash ^= (hash << 7); - hash ^= (hash >> 3); - - // Expand to fixed size - uint32_t h = hash; - for (size_t i = 0; i < FOSSIL_JELLYFISH_HASH_SIZE; ++i) { - h ^= (h >> 13); - h *= FNV_PRIME; - h ^= (h << 11); - hash_out[i] = (uint8_t)((h >> (8 * (i % 4))) & 0xFF); - } -} - static void hash_to_hex(const uint8_t *hash, size_t len, char *out_hex) { for (size_t i = 0; i < len; ++i) { sprintf(out_hex + i * 2, "%02x", hash[i]); @@ -470,129 +427,130 @@ char *fossil_io_soap_normalize(const char *text) { return normalized; } -char *fossil_io_soap_generate_audit_block(const char *text) { - if (!text) return NULL; - - char *sanitized = fossil_io_soap_sanitize(text); - if (!sanitized) return NULL; - uint8_t hash[FOSSIL_JELLYFISH_HASH_SIZE]; - char hash_hex[FOSSIL_JELLYFISH_HASH_SIZE * 2 + 1]; +char *fossil_io_soap_normalize_slang(const char *text) { + if (!text) return NULL; - fossil_io_soap_jellyfish_hash(text, sanitized, hash); - hash_to_hex(hash, FOSSIL_JELLYFISH_HASH_SIZE, hash_hex); + char *result = fossil_io_cstring_dup(text); + if (!result) return NULL; - char *audit_block = malloc(1024); - if (!audit_block) { - free(sanitized); - return NULL; + for (size_t i = 0; result[i]; i++) { + result[i] = tolower(result[i]); } - snprintf(audit_block, 1024, - "{ \"original\": \"%s\", \"sanitized\": \"%s\", \"hash\": \"%s\" }", - text, sanitized, hash_hex); - - free(sanitized); - return audit_block; -} + for (size_t i = 0; FOSSIL_SOAP_SUGGESTIONS[i].bad != NULL; i++) { + const char *bad = FOSSIL_SOAP_SUGGESTIONS[i].bad; + const char *sugg = FOSSIL_SOAP_SUGGESTIONS[i].suggested; -char *fossil_io_soap_diff_digest(const char *original, const char *transformed) { - if (!original || !transformed) return NULL; + char *found = NULL; + while ((found = custom_strcasestr(result, bad)) != NULL) { + size_t offset = found - result; + size_t newlen = strlen(result) - strlen(bad) + strlen(sugg) + 1; - size_t size = strlen(original) + strlen(transformed) + 2; - char *combo = malloc(size); - if (!combo) return NULL; + char *temp = malloc(newlen); + if (!temp) { + free(result); + return NULL; + } - snprintf(combo, size, "%s|%s", original, transformed); + strncpy(temp, result, offset); + temp[offset] = '\0'; + strcat(temp, sugg); + strcat(temp, found + strlen(bad)); - char *digest = fossil_io_cstring_dup(fossil_hash_string(combo)); - free(combo); - return digest; -} - -int fossil_io_soap_detect_sarcasm(const char *text) { - if (!text) return 0; - for (size_t i = 0; SARCASTIC_PHRASES[i]; i++) { - if (custom_strcasestr(text, SARCASTIC_PHRASES[i])) return 1; + free(result); + result = temp; + } } - return 0; -} -const char *fossil_io_soap_detect_intent(const char *text) { - if (!text) return "unknown"; - if (fossil_io_soap_detect_sarcasm(text)) return "sarcastic"; - if (custom_strcasestr(text, "please") || custom_strcasestr(text, "I would like")) - return "formal"; - if (strchr(text, '!') != NULL) return "emotional"; - return "neutral"; + return result; } -char *fossil_io_soap_flag_ethics(const char *text) { - if (!text) return NULL; - - // Simulate simple filter - const char *bad_words[] = {"stupid", "idiot", "hate", "kill", NULL}; - - char *flagged = fossil_io_cstring_dup(text); - if (!flagged) return NULL; +int fossil_io_soap_detect_clickbait(const char *text) { + if (!text) return 0; - for (size_t i = 0; bad_words[i]; i++) { - const char *ptr; - while ((ptr = custom_strcasestr(flagged, bad_words[i]))) { - size_t offset = ptr - flagged; - memset(flagged + offset, '*', strlen(bad_words[i])); + static const char *CLICKBAIT_PATTERNS[] = { + "you won't believe", + "shocking", + "what happened next", + "top [0-9]", + "things you didn't know", + "one weird trick", + "will blow your mind", + "can't handle this", + "before you die", + NULL + }; + + for (int i = 0; CLICKBAIT_PATTERNS[i] != NULL; i++) { + if (custom_strcasestr(text, CLICKBAIT_PATTERNS[i])) { + return 1; } } - return flagged; + + return 0; } -char *fossil_io_soap_list_ethics_flags(const char *text) { - if (!text) return NULL; +int fossil_io_soap_detect_exaggeration(const char *text) { + if (!text) return 0; - const char *categories[] = {"violence", "hate-speech", "bias", NULL}; - const char *keywords[] = {"kill", "hate", "stupid", NULL}; + static const char *EXAGGERATED_WORDS[] = { + "literally", "always", "never", "every", "everyone", "nobody", + "forever", "insane", "unbelievable", "outrageous", "epic", "mind-blowing", + NULL + }; - char buffer[256] = {0}; - for (size_t i = 0; keywords[i]; i++) { - if (custom_strcasestr(text, keywords[i])) { - strcat(buffer, categories[i]); - strcat(buffer, ","); + for (int i = 0; EXAGGERATED_WORDS[i] != NULL; i++) { + if (custom_strcasestr(text, EXAGGERATED_WORDS[i])) { + return 1; } } - if (strlen(buffer) > 0) buffer[strlen(buffer) - 1] = '\0'; // Remove last comma - return fossil_io_cstring_dup(buffer); + return 0; } -int fossil_io_soap_load_mindset_file(const char *filename) { - FILE *f = fopen(filename, "r"); - if (!f) return -1; - - char line[256]; - while (fgets(line, sizeof(line), f)) { - if (strncmp(line, "filter:", 7) == 0) { - char *phrase = line + 7; - while (*phrase == ' ') phrase++; - phrase[strcspn(phrase, "\r\n")] = 0; - fossil_io_soap_add_custom_filter(phrase); - } - } +char *fossil_io_soap_filter_offensive(const char *text) { + if (!text) return NULL; - fclose(f); - return 0; -} + static const struct { + const char *offensive; + const char *replacement; + } OFFENSIVE_WORDS[] = { + {"dumb", "uninformed"}, + {"stupid", "ill-advised"}, + {"idiot", "misguided"}, + {"moron", "uninformed"}, + {"sucks", "is not ideal"}, + {NULL, NULL} + }; + + char *result = fossil_io_cstring_dup(text); + if (!result) return NULL; + + for (size_t i = 0; OFFENSIVE_WORDS[i].offensive != NULL; i++) { + const char *bad = OFFENSIVE_WORDS[i].offensive; + const char *good = OFFENSIVE_WORDS[i].replacement; + + char *found = NULL; + while ((found = custom_strcasestr(result, bad)) != NULL) { + size_t offset = found - result; + size_t newlen = strlen(result) - strlen(bad) + strlen(good) + 1; + + char *temp = malloc(newlen); + if (!temp) { + free(result); + return NULL; + } -char *fossil_io_soap_export_mindset(void) { - char *output = malloc(2048); - if (!output) return NULL; - strcpy(output, "#mindset('soap') {\n"); + strncpy(temp, result, offset); + temp[offset] = '\0'; + strcat(temp, good); + strcat(temp, found + strlen(bad)); - for (size_t i = 0; i < MAX_CUSTOM_FILTERS && custom_filters[i]; i++) { - strcat(output, " filter: "); - strcat(output, custom_filters[i]); - strcat(output, "\n"); + free(result); + result = temp; + } } - strcat(output, "}\n"); - return output; + return result; } From 721db3ccadccc1320b0deb1f0191415fa35234a3 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 08:51:05 -0700 Subject: [PATCH 14/33] Update soap.c --- code/logic/soap.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/code/logic/soap.c b/code/logic/soap.c index 6b78b6b..60b1eb3 100644 --- a/code/logic/soap.c +++ b/code/logic/soap.c @@ -442,22 +442,22 @@ char *fossil_io_soap_normalize_slang(const char *text) { const char *bad = FOSSIL_SOAP_SUGGESTIONS[i].bad; const char *sugg = FOSSIL_SOAP_SUGGESTIONS[i].suggested; - char *found = NULL; + const char *found = NULL; while ((found = custom_strcasestr(result, bad)) != NULL) { - size_t offset = found - result; + size_t offset = (size_t)(found - result); size_t newlen = strlen(result) - strlen(bad) + strlen(sugg) + 1; - + char *temp = malloc(newlen); if (!temp) { free(result); return NULL; } - + strncpy(temp, result, offset); temp[offset] = '\0'; strcat(temp, sugg); - strcat(temp, found + strlen(bad)); - + strcat(temp, result + offset + strlen(bad)); + free(result); result = temp; } @@ -531,22 +531,22 @@ char *fossil_io_soap_filter_offensive(const char *text) { const char *bad = OFFENSIVE_WORDS[i].offensive; const char *good = OFFENSIVE_WORDS[i].replacement; - char *found = NULL; + const char *found = NULL; while ((found = custom_strcasestr(result, bad)) != NULL) { - size_t offset = found - result; + size_t offset = (size_t)(found - result); size_t newlen = strlen(result) - strlen(bad) + strlen(good) + 1; - + char *temp = malloc(newlen); if (!temp) { free(result); return NULL; } - + strncpy(temp, result, offset); temp[offset] = '\0'; strcat(temp, good); - strcat(temp, found + strlen(bad)); - + strcat(temp, result + offset + strlen(bad)); + free(result); result = temp; } From 70ab3e271207d631a4ab7aa03baa536f3b94a335 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 08:52:44 -0700 Subject: [PATCH 15/33] Update soap.c --- code/logic/soap.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/code/logic/soap.c b/code/logic/soap.c index 60b1eb3..cd5da2e 100644 --- a/code/logic/soap.c +++ b/code/logic/soap.c @@ -130,13 +130,6 @@ static const char *SKIP_WORDS[] = { NULL // Sentinel to mark the end }; -static void hash_to_hex(const uint8_t *hash, size_t len, char *out_hex) { - for (size_t i = 0; i < len; ++i) { - sprintf(out_hex + i * 2, "%02x", hash[i]); - } - out_hex[len * 2] = '\0'; -} - /** * @brief Convert leetspeak to normal letters. */ From 063de3f9b1d8a62a47b4d80d03d9977778e4bb5b Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 09:09:37 -0700 Subject: [PATCH 16/33] Update soap.c --- code/logic/soap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/logic/soap.c b/code/logic/soap.c index cd5da2e..3180f1a 100644 --- a/code/logic/soap.c +++ b/code/logic/soap.c @@ -398,7 +398,7 @@ int fossil_io_soap_check_grammar(const char *text) { char *fossil_io_soap_normalize(const char *text) { if (!text) return NULL; - char *normalized = strdup(text); // Create modifiable copy + char *normalized = fossil_io_cstring_dup(text); // Create modifiable copy if (!normalized) return NULL; for (size_t i = 0; FOSSIL_SOAP_SUGGESTIONS[i].bad; i++) { From 13d1cd19fd0bac79814daf30ba87f438f7c65f8f Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 09:19:28 -0700 Subject: [PATCH 17/33] Update soap.h --- code/logic/fossil/io/soap.h | 229 ++++++++++++++++++++++++++++-------- 1 file changed, 177 insertions(+), 52 deletions(-) diff --git a/code/logic/fossil/io/soap.h b/code/logic/fossil/io/soap.h index 2b44d75..c5891b2 100644 --- a/code/logic/fossil/io/soap.h +++ b/code/logic/fossil/io/soap.h @@ -166,46 +166,69 @@ float fossil_io_soap_politeness_score(const char *text); } #include +#include /** * C++ wrapper for the SOAP API. */ namespace fossil { - - /** - * Namespace for I/O operations. - */ namespace io { + /** - * SOAP API for sanitizing strings. + * @brief SOAP API for sanitizing and analyzing user text input. + * + * Provides C++ wrappers for detecting, transforming, or correcting slang, tone, sentiment, + * clickbait, and other language features with a focus on clarity and safety. */ class Soap { public: + /** - * Sanitize input text by removing or replacing "rot-brain" and meme-based language. - * - * @param text The input text to sanitize. - * @return A dynamically allocated sanitized string (must be freed by the caller). + * @brief Sanitize input by replacing meme/rot-brain terms with standard alternatives. + * + * @param text The input string. + * @return A cleaned-up version of the text. */ static std::string sanitize(const std::string &text) { - return fossil_io_soap_sanitize(text.c_str()); + std::unique_ptr ptr(fossil_io_soap_sanitize(text.c_str()), free); + return ptr ? std::string(ptr.get()) : std::string{}; } /** - * Suggest proper alternatives for rot-brain words or grammar fixes. + * @brief Sanitize input text (C-style). * - * @param text The input text. - * @param format_type Custom format for output (e.g., "*" or "#"). - * @return A dynamically allocated string with suggestions (must be freed by the caller). + * @param text The input string. + * @return A heap-allocated cleaned-up version (must be freed manually). + */ + static char* sanitize(const char* text) { + return fossil_io_soap_sanitize(text); + } + + /** + * @brief Suggest alternative expressions for slang or incorrect grammar. + * + * @param text The input string. + * @return A string with suggested improvements. */ static std::string suggest(const std::string &text) { - return fossil_io_soap_suggest(text.c_str()); + std::unique_ptr ptr(fossil_io_soap_suggest(text.c_str()), free); + return ptr ? std::string(ptr.get()) : std::string{}; } /** - * Add a custom word or phrase to the filter. - * - * @param phrase The phrase to add. + * @brief Suggest improvements (C-style). + * + * @param text The input string. + * @return A heap-allocated suggestion (must be freed manually). + */ + static char* suggest(const char* text) { + return fossil_io_soap_suggest(text); + } + + /** + * @brief Add a custom slang or flagged phrase to the filter. + * + * @param phrase The custom phrase. * @return 0 on success, nonzero on failure. */ static int add_custom_filter(const std::string &phrase) { @@ -213,68 +236,170 @@ namespace fossil { } /** - * Clear all custom filters. + * @brief Add a custom slang or flagged phrase to the filter (C-style). + * + * @param phrase The custom phrase. + * @return 0 on success, nonzero on failure. + */ + static int add_custom_filter(const char* phrase) { + return fossil_io_soap_add_custom_filter(phrase); + } + + /** + * @brief Clear all user-added custom filters. */ static void clear_custom_filters() { fossil_io_soap_clear_custom_filters(); } /** - * Detect the tone of a sentence. - * - * @param text The input text. - * @return A string representing the detected tone ("formal", "casual", "sarcastic", etc.). + * @brief Detect tone of the input (e.g., "sarcastic", "formal"). + * + * @param text The input string. + * @return A tone descriptor string. */ static std::string detect_tone(const std::string &text) { - return fossil_io_soap_detect_tone(text.c_str()); + return std::string(fossil_io_soap_detect_tone(text.c_str())); } /** - * Sanitize input text by removing or replacing "rot-brain" and meme-based language. - * - * @param text The input text to sanitize. - * @return A dynamically allocated sanitized string (must be freed by the caller). + * @brief Detect tone of the input (C-style). + * + * @param text The input string. + * @return A tone descriptor string. */ - static char* sanitize(const char* text) { - return fossil_io_soap_sanitize(text); + static const char* detect_tone(const char* text) { + return fossil_io_soap_detect_tone(text); } /** - * Suggest proper alternatives for rot-brain words or grammar fixes. - * - * @param text The input text. - * @param format_type Custom format for output (e.g., "*" or "#"). - * @return A dynamically allocated string with suggestions (must be freed by the caller). + * @brief Analyze sentiment in the input ("positive", "neutral", "negative"). + * + * @param text The input string. + * @return Sentiment label. */ - static char* suggest(const char* text) { - return fossil_io_soap_suggest(text); + static std::string detect_sentiment(const std::string &text) { + return std::string(fossil_io_soap_detect_sentiment(text.c_str())); } /** - * Add a custom word or phrase to the filter. - * - * @param phrase The phrase to add. - * @return 0 on success, nonzero on failure. + * @brief Analyze sentiment (C-style). + * + * @param text The input string. + * @return Sentiment label string. */ - static int add_custom_filter(const char* phrase) { - return fossil_io_soap_add_custom_filter(phrase); + static const char* detect_sentiment(const char* text) { + return fossil_io_soap_detect_sentiment(text); } /** - * Detect the tone of a sentence. - * - * @param text The input text. - * @return A string representing the detected tone ("formal", "casual", "sarcastic", etc.). + * @brief Check for harmful or inappropriate content. + * + * @param text The input string. + * @return true if flagged, false otherwise. */ - static const char* detect_tone(const char* text) { - return fossil_io_soap_detect_tone(text); + static bool is_harmful(const std::string &text) { + return fossil_io_soap_detect_harmful_content(text.c_str()) != 0; } - }; + /** + * @brief Check if the input contains exaggerated or hyperbolic language. + * + * @param text The input string. + * @return true if exaggerated, false otherwise. + */ + static bool is_exaggerated(const std::string &text) { + return fossil_io_soap_detect_exaggeration(text.c_str()) != 0; + } - } + /** + * @brief Check if the input uses clickbait language. + * + * @param text The input string. + * @return true if clickbait detected, false otherwise. + */ + static bool is_clickbait(const std::string &text) { + return fossil_io_soap_detect_clickbait(text.c_str()) != 0; + } -} + /** + * @brief Normalize slang and internet abbreviations. + * + * @param text The input string. + * @return A cleaned version of the input text. + */ + static std::string normalize_slang(const std::string &text) { + std::unique_ptr ptr(fossil_io_soap_normalize_slang(text.c_str()), free); + return ptr ? std::string(ptr.get()) : std::string{}; + } + + /** + * @brief Fix common grammar errors in input text. + * + * @param text The input string. + * @return A corrected version of the input. + */ + static std::string correct_grammar(const std::string &text) { + std::unique_ptr ptr(fossil_io_soap_correct_grammar(text.c_str()), free); + return ptr ? std::string(ptr.get()) : std::string{}; + } + + /** + * @brief Replace offensive language with neutral alternatives. + * + * @param text The input string. + * @return A sanitized version with offensive terms filtered out. + */ + static std::string filter_offensive(const std::string &text) { + std::unique_ptr ptr(fossil_io_soap_filter_offensive(text.c_str()), free); + return ptr ? std::string(ptr.get()) : std::string{}; + } + + /** + * @brief Attempt to identify logical fallacies in the input. + * + * @param text The input string. + * @return Description of detected fallacy or empty string. + */ + static std::string detect_fallacy(const std::string &text) { + const char* result = fossil_io_soap_detect_fallacy(text.c_str()); + return result ? std::string(result) : std::string{}; + } + + /** + * @brief Generate a brief summary of the key idea in the input. + * + * @param text The input string. + * @return Summary string. + */ + static std::string summarize(const std::string &text) { + std::unique_ptr ptr(fossil_io_soap_summarize(text.c_str()), free); + return ptr ? std::string(ptr.get()) : std::string{}; + } + + /** + * @brief Return a readability score (e.g., Flesch-Kincaid). + * + * @param text The input string. + * @return Readability score as a float. + */ + static float readability_score(const std::string &text) { + return fossil_io_soap_evaluate_readability(text.c_str()); + } + + /** + * @brief Compute a politeness score (0.0 = rude, 1.0 = very polite). + * + * @param text The input string. + * @return Politeness score. + */ + static float politeness_score(const std::string &text) { + return fossil_io_soap_politeness_score(text.c_str()); + } + }; + + } // namespace io +} // namespace fossil #endif From 147184d600f8cc2a287cde2ecad75115f13fcbf5 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 10:27:42 -0700 Subject: [PATCH 18/33] Update test_soap.c --- code/tests/cases/test_soap.c | 110 +++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/code/tests/cases/test_soap.c b/code/tests/cases/test_soap.c index 09e3c3b..4b6c385 100644 --- a/code/tests/cases/test_soap.c +++ b/code/tests/cases/test_soap.c @@ -215,6 +215,102 @@ FOSSIL_TEST(c_test_io_soap_suggest_with_tabs) { free(result); } +FOSSIL_TEST(c_test_io_soap_detect_sentiment_positive) { + const char *input = "I love this product!"; + const char *expected = "positive"; + const char *result = fossil_io_soap_detect_sentiment(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); +} + +FOSSIL_TEST(c_test_io_soap_detect_sentiment_negative) { + const char *input = "This is the worst idea ever."; + const char *expected = "negative"; + const char *result = fossil_io_soap_detect_sentiment(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); +} + +FOSSIL_TEST(c_test_io_soap_detect_sentiment_neutral) { + const char *input = "It is a pencil."; + const char *expected = "neutral"; + const char *result = fossil_io_soap_detect_sentiment(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); +} + +FOSSIL_TEST(c_test_io_soap_detect_harmful_content) { + const char *input = "You are worthless."; + int result = fossil_io_soap_detect_harmful_content(input); + ASSUME_ITS_EQUAL_I32(1, result); +} + +FOSSIL_TEST(c_test_io_soap_normalize_slang) { + const char *input = "brb, ttyl!"; + const char *expected = "be right back, talk to you later!"; + char *result = fossil_io_soap_normalize_slang(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); + free(result); +} + +FOSSIL_TEST(c_test_io_soap_correct_grammar) { + const char *input = "should of gone there"; + const char *expected = "should have gone there"; + char *result = fossil_io_soap_correct_grammar(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); + free(result); +} + +FOSSIL_TEST(c_test_io_soap_filter_offensive) { + const char *input = "You are such an idiot."; + const char *expected = "You are such an ***."; + char *result = fossil_io_soap_filter_offensive(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); + free(result); +} + +FOSSIL_TEST(c_test_io_soap_detect_clickbait) { + const char *input = "You won't believe what happened next!"; + int result = fossil_io_soap_detect_clickbait(input); + ASSUME_ITS_EQUAL_I32(1, result); +} + +FOSSIL_TEST(c_test_io_soap_detect_exaggeration) { + const char *input = "This is the greatest thing in the entire universe!"; + int result = fossil_io_soap_detect_exaggeration(input); + ASSUME_ITS_EQUAL_I32(1, result); +} + +FOSSIL_TEST(c_test_io_soap_detect_fallacy) { + const char *input = "If we allow A, then B, C, and D will also happen!"; + const char *expected = "slippery slope"; // assuming this is detected + const char *result = fossil_io_soap_detect_fallacy(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); +} + +FOSSIL_TEST(c_test_io_soap_summarize) { + const char *input = "Although the product has some flaws, it is still worth buying because of its affordability."; + const char *expected = "It's affordable despite some flaws."; // approximate + char *result = fossil_io_soap_summarize(input); + ASSUME(result != NULL); // Exact match may vary + free(result); +} + +FOSSIL_TEST(c_test_io_soap_readability_score) { + const char *input = "This sentence is simple."; + float score = fossil_io_soap_evaluate_readability(input); + ASSUME(score > 60.0); // basic readability check +} + +FOSSIL_TEST(c_test_io_soap_politeness_score_polite) { + const char *input = "Could you please help me with this?"; + float score = fossil_io_soap_politeness_score(input); + ASSUME(score > 0.8f); +} + +FOSSIL_TEST(c_test_io_soap_politeness_score_rude) { + const char *input = "Do it now."; + float score = fossil_io_soap_politeness_score(input); + ASSUME(score < 0.3f); +} + // * * * * * * * * * * * * * * * * * * * * * * * * // * Fossil Logic Test Pool // * * * * * * * * * * * * * * * * * * * * * * * * @@ -242,6 +338,20 @@ FOSSIL_TEST_GROUP(c_soap_tests) { FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_special_chars); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_newlines); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_tabs); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_positive); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_negative); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_neutral); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_harmful_content); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_normalize_slang); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_correct_grammar); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_filter_offensive); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_clickbait); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_exaggeration); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_fallacy); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_summarize); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_readability_score); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_politeness_score_polite); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_politeness_score_rude); FOSSIL_TEST_REGISTER(c_soap_suite); } From 206fd57c9bca08da16080a80254d2e5f6fdcd964 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 11:37:52 -0700 Subject: [PATCH 19/33] Update test_soap.c --- code/tests/cases/test_soap.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/code/tests/cases/test_soap.c b/code/tests/cases/test_soap.c index 4b6c385..aa5435c 100644 --- a/code/tests/cases/test_soap.c +++ b/code/tests/cases/test_soap.c @@ -289,28 +289,10 @@ FOSSIL_TEST(c_test_io_soap_summarize) { const char *input = "Although the product has some flaws, it is still worth buying because of its affordability."; const char *expected = "It's affordable despite some flaws."; // approximate char *result = fossil_io_soap_summarize(input); - ASSUME(result != NULL); // Exact match may vary + ASSUME_ITS_TRUE(result != NULL); // Exact match may vary free(result); } -FOSSIL_TEST(c_test_io_soap_readability_score) { - const char *input = "This sentence is simple."; - float score = fossil_io_soap_evaluate_readability(input); - ASSUME(score > 60.0); // basic readability check -} - -FOSSIL_TEST(c_test_io_soap_politeness_score_polite) { - const char *input = "Could you please help me with this?"; - float score = fossil_io_soap_politeness_score(input); - ASSUME(score > 0.8f); -} - -FOSSIL_TEST(c_test_io_soap_politeness_score_rude) { - const char *input = "Do it now."; - float score = fossil_io_soap_politeness_score(input); - ASSUME(score < 0.3f); -} - // * * * * * * * * * * * * * * * * * * * * * * * * // * Fossil Logic Test Pool // * * * * * * * * * * * * * * * * * * * * * * * * @@ -349,9 +331,6 @@ FOSSIL_TEST_GROUP(c_soap_tests) { FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_exaggeration); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_fallacy); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_summarize); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_readability_score); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_politeness_score_polite); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_politeness_score_rude); FOSSIL_TEST_REGISTER(c_soap_suite); } From 1d11e21c76adb892b6e86aa0660f18c8bc5eb262 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 12:06:58 -0700 Subject: [PATCH 20/33] Update test_soap.c --- code/tests/cases/test_soap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/code/tests/cases/test_soap.c b/code/tests/cases/test_soap.c index aa5435c..7785507 100644 --- a/code/tests/cases/test_soap.c +++ b/code/tests/cases/test_soap.c @@ -287,9 +287,14 @@ FOSSIL_TEST(c_test_io_soap_detect_fallacy) { FOSSIL_TEST(c_test_io_soap_summarize) { const char *input = "Although the product has some flaws, it is still worth buying because of its affordability."; - const char *expected = "It's affordable despite some flaws."; // approximate + const char *expected = "affordable despite some flaws"; // approximate key meaning + char *result = fossil_io_soap_summarize(input); - ASSUME_ITS_TRUE(result != NULL); // Exact match may vary + ASSUME_ITS_TRUE(result != NULL); + + // Check if expected meaning is included in the result + ASSUME_ITS_TRUE(strstr(result, expected) != NULL); + free(result); } From 4e6580ecef59039d907e17b0b9def3549837fbac Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 13:51:31 -0700 Subject: [PATCH 21/33] Update test_soap.c --- code/tests/cases/test_soap.c | 94 ------------------------------------ 1 file changed, 94 deletions(-) diff --git a/code/tests/cases/test_soap.c b/code/tests/cases/test_soap.c index 7785507..09e3c3b 100644 --- a/code/tests/cases/test_soap.c +++ b/code/tests/cases/test_soap.c @@ -215,89 +215,6 @@ FOSSIL_TEST(c_test_io_soap_suggest_with_tabs) { free(result); } -FOSSIL_TEST(c_test_io_soap_detect_sentiment_positive) { - const char *input = "I love this product!"; - const char *expected = "positive"; - const char *result = fossil_io_soap_detect_sentiment(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); -} - -FOSSIL_TEST(c_test_io_soap_detect_sentiment_negative) { - const char *input = "This is the worst idea ever."; - const char *expected = "negative"; - const char *result = fossil_io_soap_detect_sentiment(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); -} - -FOSSIL_TEST(c_test_io_soap_detect_sentiment_neutral) { - const char *input = "It is a pencil."; - const char *expected = "neutral"; - const char *result = fossil_io_soap_detect_sentiment(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); -} - -FOSSIL_TEST(c_test_io_soap_detect_harmful_content) { - const char *input = "You are worthless."; - int result = fossil_io_soap_detect_harmful_content(input); - ASSUME_ITS_EQUAL_I32(1, result); -} - -FOSSIL_TEST(c_test_io_soap_normalize_slang) { - const char *input = "brb, ttyl!"; - const char *expected = "be right back, talk to you later!"; - char *result = fossil_io_soap_normalize_slang(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); - free(result); -} - -FOSSIL_TEST(c_test_io_soap_correct_grammar) { - const char *input = "should of gone there"; - const char *expected = "should have gone there"; - char *result = fossil_io_soap_correct_grammar(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); - free(result); -} - -FOSSIL_TEST(c_test_io_soap_filter_offensive) { - const char *input = "You are such an idiot."; - const char *expected = "You are such an ***."; - char *result = fossil_io_soap_filter_offensive(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); - free(result); -} - -FOSSIL_TEST(c_test_io_soap_detect_clickbait) { - const char *input = "You won't believe what happened next!"; - int result = fossil_io_soap_detect_clickbait(input); - ASSUME_ITS_EQUAL_I32(1, result); -} - -FOSSIL_TEST(c_test_io_soap_detect_exaggeration) { - const char *input = "This is the greatest thing in the entire universe!"; - int result = fossil_io_soap_detect_exaggeration(input); - ASSUME_ITS_EQUAL_I32(1, result); -} - -FOSSIL_TEST(c_test_io_soap_detect_fallacy) { - const char *input = "If we allow A, then B, C, and D will also happen!"; - const char *expected = "slippery slope"; // assuming this is detected - const char *result = fossil_io_soap_detect_fallacy(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); -} - -FOSSIL_TEST(c_test_io_soap_summarize) { - const char *input = "Although the product has some flaws, it is still worth buying because of its affordability."; - const char *expected = "affordable despite some flaws"; // approximate key meaning - - char *result = fossil_io_soap_summarize(input); - ASSUME_ITS_TRUE(result != NULL); - - // Check if expected meaning is included in the result - ASSUME_ITS_TRUE(strstr(result, expected) != NULL); - - free(result); -} - // * * * * * * * * * * * * * * * * * * * * * * * * // * Fossil Logic Test Pool // * * * * * * * * * * * * * * * * * * * * * * * * @@ -325,17 +242,6 @@ FOSSIL_TEST_GROUP(c_soap_tests) { FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_special_chars); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_newlines); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_tabs); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_positive); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_negative); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_neutral); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_harmful_content); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_normalize_slang); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_correct_grammar); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_filter_offensive); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_clickbait); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_exaggeration); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_fallacy); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_summarize); FOSSIL_TEST_REGISTER(c_soap_suite); } From 9a2ed793e41b481cad26c35d5dac8b1839d885f5 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:18:47 -0600 Subject: [PATCH 22/33] Update test_soap.c --- code/tests/cases/test_soap.c | 66 ++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/code/tests/cases/test_soap.c b/code/tests/cases/test_soap.c index 09e3c3b..38c722d 100644 --- a/code/tests/cases/test_soap.c +++ b/code/tests/cases/test_soap.c @@ -215,6 +215,64 @@ FOSSIL_TEST(c_test_io_soap_suggest_with_tabs) { free(result); } +FOSSIL_TEST(c_test_io_soap_detect_bias_political) { + const char *input = "All liberals are wrong."; + const char *expected = "political-bias"; + const char *result = fossil_io_soap_detect_bias(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); +} + +FOSSIL_TEST(c_test_io_soap_detect_bias_noneutral) { + const char *input = "Dogs are better than cats."; + const char *expected = "subjective-bias"; + const char *result = fossil_io_soap_detect_bias(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); +} + +FOSSIL_TEST(c_test_io_soap_detect_fake_news_true_case) { + const char *input = "NASA confirms moon is made of cheese."; + const char *expected = "fake"; + const char *result = fossil_io_soap_detect_fake_news(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); +} + +FOSSIL_TEST(c_test_io_soap_detect_fake_news_valid_fact) { + const char *input = "The Earth revolves around the Sun."; + const char *expected = "valid"; + const char *result = fossil_io_soap_detect_fake_news(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); +} + +FOSSIL_TEST(c_test_io_soap_correct_grammar_typo) { + const char *input = "He go to school every day."; + const char *expected = "He goes to school every day."; + char *result = fossil_io_soap_correct_grammar(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); + free(result); +} + +FOSSIL_TEST(c_test_io_soap_correct_grammar_punctuation) { + const char *input = "hello how are you"; + const char *expected = "Hello, how are you?"; + char *result = fossil_io_soap_correct_grammar(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); + free(result); +} + +FOSSIL_TEST(c_test_io_soap_fuzzy_match_simple) { + const char *a = "rotbrain"; + const char *b = "rot-brain"; + bool result = fossil_io_soap_fuzzy_match(a, b); + ASSUME_ITS_TRUE(result); +} + +FOSSIL_TEST(c_test_io_soap_fuzzy_match_fail) { + const char *a = "hello"; + const char *b = "goodbye"; + bool result = fossil_io_soap_fuzzy_match(a, b); + ASSUME_ITS_TRUE(!result); +} + // * * * * * * * * * * * * * * * * * * * * * * * * // * Fossil Logic Test Pool // * * * * * * * * * * * * * * * * * * * * * * * * @@ -242,6 +300,14 @@ FOSSIL_TEST_GROUP(c_soap_tests) { FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_special_chars); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_newlines); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_tabs); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_bias_political); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_bias_noneutral); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_fake_news_true_case); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_fake_news_valid_fact); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_correct_grammar_typo); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_correct_grammar_punctuation); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_fuzzy_match_simple); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_fuzzy_match_fail); FOSSIL_TEST_REGISTER(c_soap_suite); } From de668829a604dd8cc4e30b48c69bae61c4e5aa0a Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:28:29 -0600 Subject: [PATCH 23/33] Update test_soap.c --- code/tests/cases/test_soap.c | 155 +++++++++++++++++++++++++---------- 1 file changed, 112 insertions(+), 43 deletions(-) diff --git a/code/tests/cases/test_soap.c b/code/tests/cases/test_soap.c index 38c722d..74f4141 100644 --- a/code/tests/cases/test_soap.c +++ b/code/tests/cases/test_soap.c @@ -215,62 +215,120 @@ FOSSIL_TEST(c_test_io_soap_suggest_with_tabs) { free(result); } -FOSSIL_TEST(c_test_io_soap_detect_bias_political) { - const char *input = "All liberals are wrong."; - const char *expected = "political-bias"; - const char *result = fossil_io_soap_detect_bias(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); +FOSSIL_TEST(c_test_io_soap_check_grammar_valid) { + const char *input = "She writes clearly and concisely."; + ASSUME_ITS_TRUE(fossil_io_soap_check_grammar(input) == 0); } -FOSSIL_TEST(c_test_io_soap_detect_bias_noneutral) { - const char *input = "Dogs are better than cats."; - const char *expected = "subjective-bias"; - const char *result = fossil_io_soap_detect_bias(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); +FOSSIL_TEST(c_test_io_soap_check_grammar_error) { + const char *input = "Him go store."; + ASSUME_ITS_TRUE(fossil_io_soap_check_grammar(input) != 0); } -FOSSIL_TEST(c_test_io_soap_detect_fake_news_true_case) { - const char *input = "NASA confirms moon is made of cheese."; - const char *expected = "fake"; - const char *result = fossil_io_soap_detect_fake_news(input); +FOSSIL_TEST(c_test_io_soap_normalize_informal) { + const char *input = "u gotta see this"; + const char *expected = "you have to see this"; + char *result = fossil_io_soap_normalize(input); ASSUME_ITS_EQUAL_CSTR(expected, result); + free(result); +} + +FOSSIL_TEST(c_test_io_soap_detect_sentiment_positive) { + const char *input = "I love working with you!"; + const char *expected = "positive"; + ASSUME_ITS_EQUAL_CSTR(expected, fossil_io_soap_detect_sentiment(input)); +} + +FOSSIL_TEST(c_test_io_soap_detect_sentiment_negative) { + const char *input = "This is the worst experience ever."; + const char *expected = "negative"; + ASSUME_ITS_EQUAL_CSTR(expected, fossil_io_soap_detect_sentiment(input)); } -FOSSIL_TEST(c_test_io_soap_detect_fake_news_valid_fact) { - const char *input = "The Earth revolves around the Sun."; - const char *expected = "valid"; - const char *result = fossil_io_soap_detect_fake_news(input); +FOSSIL_TEST(c_test_io_soap_detect_harmful_true) { + const char *input = "People like you shouldn't exist."; + ASSUME_ITS_TRUE(fossil_io_soap_detect_harmful_content(input) == 1); +} + +FOSSIL_TEST(c_test_io_soap_detect_harmful_false) { + const char *input = "I disagree with your opinion."; + ASSUME_ITS_TRUE(fossil_io_soap_detect_harmful_content(input) == 0); +} + +FOSSIL_TEST(c_test_io_soap_normalize_slang_basic) { + const char *input = "idk why ppl do that lol"; + const char *expected = "I don't know why people do that."; + char *result = fossil_io_soap_normalize_slang(input); ASSUME_ITS_EQUAL_CSTR(expected, result); + free(result); } -FOSSIL_TEST(c_test_io_soap_correct_grammar_typo) { - const char *input = "He go to school every day."; - const char *expected = "He goes to school every day."; +FOSSIL_TEST(c_test_io_soap_correct_grammar_common) { + const char *input = "He go to work every day."; + const char *expected = "He goes to work every day."; char *result = fossil_io_soap_correct_grammar(input); ASSUME_ITS_EQUAL_CSTR(expected, result); free(result); } -FOSSIL_TEST(c_test_io_soap_correct_grammar_punctuation) { - const char *input = "hello how are you"; - const char *expected = "Hello, how are you?"; - char *result = fossil_io_soap_correct_grammar(input); +FOSSIL_TEST(c_test_io_soap_evaluate_readability_score) { + const char *input = "The cat sat on the mat."; + float score = fossil_io_soap_evaluate_readability(input); + ASSUME_ITS_TRUE(score > 0.0); +} + +FOSSIL_TEST(c_test_io_soap_detect_exaggeration_true) { + const char *input = "This is the worst thing to ever happen in history!"; + ASSUME_ITS_TRUE(fossil_io_soap_detect_exaggeration(input) == 1); +} + +FOSSIL_TEST(c_test_io_soap_detect_exaggeration_false) { + const char *input = "The weather is mildly unpleasant today."; + ASSUME(fossil_io_soap_detect_exaggeration(input) == 0); +} + +FOSSIL_TEST(c_test_io_soap_filter_offensive_basic) { + const char *input = "You're an idiot."; + const char *expected = "You're being unreasonable."; + char *result = fossil_io_soap_filter_offensive(input); ASSUME_ITS_EQUAL_CSTR(expected, result); free(result); } -FOSSIL_TEST(c_test_io_soap_fuzzy_match_simple) { - const char *a = "rotbrain"; - const char *b = "rot-brain"; - bool result = fossil_io_soap_fuzzy_match(a, b); - ASSUME_ITS_TRUE(result); +FOSSIL_TEST(c_test_io_soap_detect_clickbait_true) { + const char *input = "You won't believe what happened next!"; + ASSUME_ITS_TRUE(fossil_io_soap_detect_clickbait(input) == 1); +} + +FOSSIL_TEST(c_test_io_soap_detect_clickbait_false) { + const char *input = "Scientists publish new findings in journal."; + ASSUME_ITS_TRUE(fossil_io_soap_detect_clickbait(input) == 0); +} + +FOSSIL_TEST(c_test_io_soap_detect_fallacy_ad_hominem) { + const char *input = "You can't trust his argument because he's ugly."; + const char *expected = "ad hominem"; + const char *result = fossil_io_soap_detect_fallacy(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); +} + +FOSSIL_TEST(c_test_io_soap_detect_fallacy_none) { + const char *input = "We should implement this plan because it has proven benefits."; + ASSUME_ITS_TRUE(fossil_io_soap_detect_fallacy(input) == NULL); +} + +FOSSIL_TEST(c_test_io_soap_summarize_simple) { + const char *input = "The project aims to reduce emissions by introducing cleaner technologies and improving energy efficiency across sectors."; + const char *expected = "Project reduces emissions."; + char *result = fossil_io_soap_summarize(input); + ASSUME_ITS_EQUAL_CSTR(expected, result); + free(result); } -FOSSIL_TEST(c_test_io_soap_fuzzy_match_fail) { - const char *a = "hello"; - const char *b = "goodbye"; - bool result = fossil_io_soap_fuzzy_match(a, b); - ASSUME_ITS_TRUE(!result); +FOSSIL_TEST(c_test_io_soap_politeness_score_range) { + const char *input = "Could you please help me with this task?"; + float score = fossil_io_soap_politeness_score(input); + ASSUME_ITS_TRUE(score >= 0.0f && score <= 1.0f); } // * * * * * * * * * * * * * * * * * * * * * * * * @@ -300,14 +358,25 @@ FOSSIL_TEST_GROUP(c_soap_tests) { FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_special_chars); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_newlines); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_suggest_with_tabs); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_bias_political); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_bias_noneutral); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_fake_news_true_case); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_fake_news_valid_fact); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_correct_grammar_typo); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_correct_grammar_punctuation); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_fuzzy_match_simple); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_fuzzy_match_fail); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_check_grammar_valid); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_check_grammar_error); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_normalize_informal); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_positive); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_negative); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_harmful_true); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_harmful_false); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_normalize_slang_basic); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_correct_grammar_common); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_evaluate_readability_score); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_exaggeration_true); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_exaggeration_false); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_filter_offensive_basic); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_clickbait_true); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_clickbait_false); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_fallacy_ad_hominem); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_fallacy_none); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_summarize_simple); + FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_politeness_score_range); FOSSIL_TEST_REGISTER(c_soap_suite); } From eca00da133f9431ffe3fc689534b025abec45ea6 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:32:18 -0600 Subject: [PATCH 24/33] Update test_soap.c --- code/tests/cases/test_soap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/tests/cases/test_soap.c b/code/tests/cases/test_soap.c index 74f4141..10c82ca 100644 --- a/code/tests/cases/test_soap.c +++ b/code/tests/cases/test_soap.c @@ -284,7 +284,7 @@ FOSSIL_TEST(c_test_io_soap_detect_exaggeration_true) { FOSSIL_TEST(c_test_io_soap_detect_exaggeration_false) { const char *input = "The weather is mildly unpleasant today."; - ASSUME(fossil_io_soap_detect_exaggeration(input) == 0); + ASSUME_ITS_TRUE(fossil_io_soap_detect_exaggeration(input) == 0); } FOSSIL_TEST(c_test_io_soap_filter_offensive_basic) { From c5520175deaa1bf16529bdfd63dd7c3822387e1d Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:40:11 -0600 Subject: [PATCH 25/33] Update test_soap.c --- code/tests/cases/test_soap.c | 51 ------------------------------------ 1 file changed, 51 deletions(-) diff --git a/code/tests/cases/test_soap.c b/code/tests/cases/test_soap.c index 10c82ca..7f34668 100644 --- a/code/tests/cases/test_soap.c +++ b/code/tests/cases/test_soap.c @@ -245,16 +245,6 @@ FOSSIL_TEST(c_test_io_soap_detect_sentiment_negative) { ASSUME_ITS_EQUAL_CSTR(expected, fossil_io_soap_detect_sentiment(input)); } -FOSSIL_TEST(c_test_io_soap_detect_harmful_true) { - const char *input = "People like you shouldn't exist."; - ASSUME_ITS_TRUE(fossil_io_soap_detect_harmful_content(input) == 1); -} - -FOSSIL_TEST(c_test_io_soap_detect_harmful_false) { - const char *input = "I disagree with your opinion."; - ASSUME_ITS_TRUE(fossil_io_soap_detect_harmful_content(input) == 0); -} - FOSSIL_TEST(c_test_io_soap_normalize_slang_basic) { const char *input = "idk why ppl do that lol"; const char *expected = "I don't know why people do that."; @@ -263,20 +253,6 @@ FOSSIL_TEST(c_test_io_soap_normalize_slang_basic) { free(result); } -FOSSIL_TEST(c_test_io_soap_correct_grammar_common) { - const char *input = "He go to work every day."; - const char *expected = "He goes to work every day."; - char *result = fossil_io_soap_correct_grammar(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); - free(result); -} - -FOSSIL_TEST(c_test_io_soap_evaluate_readability_score) { - const char *input = "The cat sat on the mat."; - float score = fossil_io_soap_evaluate_readability(input); - ASSUME_ITS_TRUE(score > 0.0); -} - FOSSIL_TEST(c_test_io_soap_detect_exaggeration_true) { const char *input = "This is the worst thing to ever happen in history!"; ASSUME_ITS_TRUE(fossil_io_soap_detect_exaggeration(input) == 1); @@ -305,26 +281,6 @@ FOSSIL_TEST(c_test_io_soap_detect_clickbait_false) { ASSUME_ITS_TRUE(fossil_io_soap_detect_clickbait(input) == 0); } -FOSSIL_TEST(c_test_io_soap_detect_fallacy_ad_hominem) { - const char *input = "You can't trust his argument because he's ugly."; - const char *expected = "ad hominem"; - const char *result = fossil_io_soap_detect_fallacy(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); -} - -FOSSIL_TEST(c_test_io_soap_detect_fallacy_none) { - const char *input = "We should implement this plan because it has proven benefits."; - ASSUME_ITS_TRUE(fossil_io_soap_detect_fallacy(input) == NULL); -} - -FOSSIL_TEST(c_test_io_soap_summarize_simple) { - const char *input = "The project aims to reduce emissions by introducing cleaner technologies and improving energy efficiency across sectors."; - const char *expected = "Project reduces emissions."; - char *result = fossil_io_soap_summarize(input); - ASSUME_ITS_EQUAL_CSTR(expected, result); - free(result); -} - FOSSIL_TEST(c_test_io_soap_politeness_score_range) { const char *input = "Could you please help me with this task?"; float score = fossil_io_soap_politeness_score(input); @@ -363,19 +319,12 @@ FOSSIL_TEST_GROUP(c_soap_tests) { FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_normalize_informal); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_positive); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_negative); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_harmful_true); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_harmful_false); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_normalize_slang_basic); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_correct_grammar_common); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_evaluate_readability_score); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_exaggeration_true); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_exaggeration_false); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_filter_offensive_basic); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_clickbait_true); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_clickbait_false); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_fallacy_ad_hominem); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_fallacy_none); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_summarize_simple); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_politeness_score_range); FOSSIL_TEST_REGISTER(c_soap_suite); From 753cb4cb4237fb94636f2a4230e4b1f1e7a6e038 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:44:01 -0600 Subject: [PATCH 26/33] Update test_soap.c --- code/tests/cases/test_soap.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/code/tests/cases/test_soap.c b/code/tests/cases/test_soap.c index 7f34668..acb8e29 100644 --- a/code/tests/cases/test_soap.c +++ b/code/tests/cases/test_soap.c @@ -233,18 +233,6 @@ FOSSIL_TEST(c_test_io_soap_normalize_informal) { free(result); } -FOSSIL_TEST(c_test_io_soap_detect_sentiment_positive) { - const char *input = "I love working with you!"; - const char *expected = "positive"; - ASSUME_ITS_EQUAL_CSTR(expected, fossil_io_soap_detect_sentiment(input)); -} - -FOSSIL_TEST(c_test_io_soap_detect_sentiment_negative) { - const char *input = "This is the worst experience ever."; - const char *expected = "negative"; - ASSUME_ITS_EQUAL_CSTR(expected, fossil_io_soap_detect_sentiment(input)); -} - FOSSIL_TEST(c_test_io_soap_normalize_slang_basic) { const char *input = "idk why ppl do that lol"; const char *expected = "I don't know why people do that."; @@ -281,12 +269,6 @@ FOSSIL_TEST(c_test_io_soap_detect_clickbait_false) { ASSUME_ITS_TRUE(fossil_io_soap_detect_clickbait(input) == 0); } -FOSSIL_TEST(c_test_io_soap_politeness_score_range) { - const char *input = "Could you please help me with this task?"; - float score = fossil_io_soap_politeness_score(input); - ASSUME_ITS_TRUE(score >= 0.0f && score <= 1.0f); -} - // * * * * * * * * * * * * * * * * * * * * * * * * // * Fossil Logic Test Pool // * * * * * * * * * * * * * * * * * * * * * * * * @@ -317,15 +299,12 @@ FOSSIL_TEST_GROUP(c_soap_tests) { FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_check_grammar_valid); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_check_grammar_error); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_normalize_informal); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_positive); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_sentiment_negative); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_normalize_slang_basic); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_exaggeration_true); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_exaggeration_false); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_filter_offensive_basic); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_clickbait_true); FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_detect_clickbait_false); - FOSSIL_TEST_ADD(c_soap_suite, c_test_io_soap_politeness_score_range); FOSSIL_TEST_REGISTER(c_soap_suite); } From 40e51034802555ba916289f28a622f8214f27d46 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:52:47 -0600 Subject: [PATCH 27/33] Update soap.h --- code/logic/fossil/io/soap.h | 98 ------------------------------------- 1 file changed, 98 deletions(-) diff --git a/code/logic/fossil/io/soap.h b/code/logic/fossil/io/soap.h index c5891b2..28b55c6 100644 --- a/code/logic/fossil/io/soap.h +++ b/code/logic/fossil/io/soap.h @@ -74,22 +74,6 @@ int fossil_io_soap_check_grammar(const char *text); */ char *fossil_io_soap_normalize(const char *text); -/** - * @brief Analyze the sentiment of the input text. - * - * @param text The input string. - * @return A string like "positive", "negative", or "neutral". - */ -const char *fossil_io_soap_detect_sentiment(const char *text); - -/** - * @brief Detect potential hate speech or harmful content. - * - * @param text The input string. - * @return 1 if harmful content is detected, 0 otherwise. - */ -int fossil_io_soap_detect_harmful_content(const char *text); - /** * @brief Normalize internet slang or leetspeak in input text. * @@ -106,14 +90,6 @@ char *fossil_io_soap_normalize_slang(const char *text); */ char *fossil_io_soap_correct_grammar(const char *text); -/** - * @brief Evaluate the clarity and readability level of the input text. - * - * @param text The input string. - * @return Readability score (e.g., Flesch-Kincaid grade level). - */ -float fossil_io_soap_evaluate_readability(const char *text); - /** * @brief Detect exaggeration or hyperbolic language in a sentence. * @@ -138,30 +114,6 @@ char *fossil_io_soap_filter_offensive(const char *text); */ int fossil_io_soap_detect_clickbait(const char *text); -/** - * @brief Detect logical fallacies or flawed reasoning in a sentence. - * - * @param text The input string. - * @return A string describing the detected fallacy, or NULL if none found. - */ -const char *fossil_io_soap_detect_fallacy(const char *text); - -/** - * @brief Summarize the key idea in the input sentence. - * - * @param text The input string. - * @return A dynamically allocated short summary (must be freed). - */ -char *fossil_io_soap_summarize(const char *text); - -/** - * @brief Score how polite or impolite the tone of the input is. - * - * @param text The input string. - * @return A score from 0.0 (rude) to 1.0 (very polite). - */ -float fossil_io_soap_politeness_score(const char *text); - #ifdef __cplusplus } @@ -272,36 +224,6 @@ namespace fossil { return fossil_io_soap_detect_tone(text); } - /** - * @brief Analyze sentiment in the input ("positive", "neutral", "negative"). - * - * @param text The input string. - * @return Sentiment label. - */ - static std::string detect_sentiment(const std::string &text) { - return std::string(fossil_io_soap_detect_sentiment(text.c_str())); - } - - /** - * @brief Analyze sentiment (C-style). - * - * @param text The input string. - * @return Sentiment label string. - */ - static const char* detect_sentiment(const char* text) { - return fossil_io_soap_detect_sentiment(text); - } - - /** - * @brief Check for harmful or inappropriate content. - * - * @param text The input string. - * @return true if flagged, false otherwise. - */ - static bool is_harmful(const std::string &text) { - return fossil_io_soap_detect_harmful_content(text.c_str()) != 0; - } - /** * @brief Check if the input contains exaggerated or hyperbolic language. * @@ -376,26 +298,6 @@ namespace fossil { std::unique_ptr ptr(fossil_io_soap_summarize(text.c_str()), free); return ptr ? std::string(ptr.get()) : std::string{}; } - - /** - * @brief Return a readability score (e.g., Flesch-Kincaid). - * - * @param text The input string. - * @return Readability score as a float. - */ - static float readability_score(const std::string &text) { - return fossil_io_soap_evaluate_readability(text.c_str()); - } - - /** - * @brief Compute a politeness score (0.0 = rude, 1.0 = very polite). - * - * @param text The input string. - * @return Politeness score. - */ - static float politeness_score(const std::string &text) { - return fossil_io_soap_politeness_score(text.c_str()); - } }; } // namespace io From e6718383b4f01940cff373edf02bdc5603dc69a3 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:54:41 -0600 Subject: [PATCH 28/33] Update soap.h --- code/logic/fossil/io/soap.h | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/code/logic/fossil/io/soap.h b/code/logic/fossil/io/soap.h index 28b55c6..515d695 100644 --- a/code/logic/fossil/io/soap.h +++ b/code/logic/fossil/io/soap.h @@ -276,28 +276,6 @@ namespace fossil { std::unique_ptr ptr(fossil_io_soap_filter_offensive(text.c_str()), free); return ptr ? std::string(ptr.get()) : std::string{}; } - - /** - * @brief Attempt to identify logical fallacies in the input. - * - * @param text The input string. - * @return Description of detected fallacy or empty string. - */ - static std::string detect_fallacy(const std::string &text) { - const char* result = fossil_io_soap_detect_fallacy(text.c_str()); - return result ? std::string(result) : std::string{}; - } - - /** - * @brief Generate a brief summary of the key idea in the input. - * - * @param text The input string. - * @return Summary string. - */ - static std::string summarize(const std::string &text) { - std::unique_ptr ptr(fossil_io_soap_summarize(text.c_str()), free); - return ptr ? std::string(ptr.get()) : std::string{}; - } }; } // namespace io From a096e1ae2ea830de513c12d424b445a8c9bb2491 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:56:30 -0600 Subject: [PATCH 29/33] Update fossil-test.wrap --- subprojects/fossil-test.wrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/fossil-test.wrap b/subprojects/fossil-test.wrap index 8e935a5..f025ad4 100644 --- a/subprojects/fossil-test.wrap +++ b/subprojects/fossil-test.wrap @@ -3,7 +3,7 @@ # ====================== [wrap-git] url = https://github.com/fossillogic/fossil-test.git -revision = v1.2.4 +revision = v1.2.5 [provide] fossil-test = fossil_test_dep From c7b80996eccf1d540f34bc8654fbb6c5999c7b89 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:57:01 -0600 Subject: [PATCH 30/33] Update network.c --- code/logic/network.c | 1 + 1 file changed, 1 insertion(+) diff --git a/code/logic/network.c b/code/logic/network.c index e090d03..7cbc6e7 100644 --- a/code/logic/network.c +++ b/code/logic/network.c @@ -44,6 +44,7 @@ struct fossil_nstream_t { static char fossil_last_error[256] = {0}; + static void fossil_set_last_error(const char *msg) { snprintf(fossil_last_error, sizeof(fossil_last_error), "%s", msg); } From 6f703d4ef885e066bb91d621d4d3914e81d61823 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:59:00 -0600 Subject: [PATCH 31/33] Update meson_ci.yml --- .github/workflows/meson_ci.yml | 65 +++++++--------------------------- 1 file changed, 13 insertions(+), 52 deletions(-) diff --git a/.github/workflows/meson_ci.yml b/.github/workflows/meson_ci.yml index 7d0e457..969817d 100644 --- a/.github/workflows/meson_ci.yml +++ b/.github/workflows/meson_ci.yml @@ -5,8 +5,6 @@ on: paths: - "**.c" - "**.h" - - "**.cpp" - - "**.hpp" - "**.py" - "**.build" - "**.options" @@ -14,8 +12,6 @@ on: paths: - "**.c" - "**.h" - - "**.cpp" - - "**.hpp" - "**.py" - "**.build" - "**.options" @@ -26,7 +22,7 @@ jobs: runs-on: windows-latest strategy: matrix: - msvc_version: [2015, 2017, 2019, 2022] + msvc_version: [2015, 2017, 2019, 2022, 2025] steps: - name: Checkout code uses: actions/checkout@v4 @@ -51,6 +47,8 @@ jobs: choco install visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --passive" } elseif ($env:msvc_version -eq "2022") { choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --passive" + } elseif ($env:msvc_version -eq "2025") { + choco install visualstudio2025buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --passive" } $env:CC="cl.exe" $env:CXX="cl.exe" @@ -58,18 +56,8 @@ jobs: - name: Configure run: meson setup builddir_msvc_${{ matrix.msvc_version }} --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 - - name: Compile - run: meson compile -C builddir_msvc_${{ matrix.msvc_version }} - - name: Run Tests - run: meson test -C builddir_msvc_${{ matrix.msvc_version }} -v - - - name: Upload Test Log - if: failure() - uses: actions/upload-artifact@v4 - with: - name: windows_msvc_${{ matrix.msvc_version }}_meson_testlog - path: builddir_msvc_${{ matrix.msvc_version }}/meson-logs/testlog.txt + run: meson test -C builddir_msvc_${{ matrix.msvc_version }} -v --test-args='show --mode tree --verbose ci --result fail' build_macosx: name: Building on macOS with Xcode ${{ matrix.xcode_version }} @@ -98,18 +86,8 @@ jobs: - name: Configure run: meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 - - name: Compile - run: meson compile -C builddir - - name: Run Tests - run: meson test -C builddir -v - - - name: Upload Test Log - if: failure() - uses: actions/upload-artifact@v4 - with: - name: macos_xcode_${{ matrix.xcode_version }}_meson_testlog - path: builddir/meson-logs/testlog.txt + run: meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail' build_msys: name: Building on MSYS ${{ matrix.architecture }} @@ -145,18 +123,8 @@ jobs: - name: Configure run: meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 - - name: Compile - run: meson compile -C builddir - - name: Run Tests - run: meson test -C builddir -v - - - name: Upload Test Log - if: failure() - uses: actions/upload-artifact@v4 - with: - name: msys_${{ matrix.architecture }}_meson_testlog - path: builddir/meson-logs/testlog.txt + run: meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail' build_mingw: name: Building on MinGW ${{ matrix.architecture }} @@ -196,18 +164,8 @@ jobs: - name: Configure run: meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 - - name: Compile - run: meson compile -C builddir - - name: Run Tests - run: meson test -C builddir -v - - - name: Upload Test Log - if: failure() - uses: actions/upload-artifact@v4 - with: - name: mingw_${{ matrix.architecture }}_meson_testlog - path: builddir/meson-logs/testlog.txt + run: meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail' build_posix: name: Build on Linux ${{ matrix.distro }} @@ -249,8 +207,7 @@ jobs: /bin/bash -c " sudo apt update meson setup builddir --fatal-meson-warnings -Dwerror=true -Dwith_test=enabled -Dwarning_level=3 - meson compile -C builddir - meson test -C builddir -v" + meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail'" build_cross: name: Building on Bedrock ${{ matrix.architecture }} @@ -344,4 +301,8 @@ jobs: - name: Build the Project run: | - meson compile -C builddir \ No newline at end of file + meson compile -C builddir + + - name: Test the Project + run: | + meson test -C builddir -v --test-args='show --mode tree --verbose ci --result fail' From 6ff03a0c371a0c6062fad7d9fcc10bf00ee1234c Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:59:40 -0600 Subject: [PATCH 32/33] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aa64560..804cd28 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ To get started with Fossil Io, ensure you have the following installed: # ====================== [wrap-git] url = https://github.com/fossillogic/fossil-io.git - revision = v0.2.1 + revision = v0.2.2 [provide] fossil-io = fossil_io_dep From 8d3415bbecb935f183c06f166540b2f26d235dd9 Mon Sep 17 00:00:00 2001 From: "Michael Gene Brockus (Dreamer)" <55331536+dreamer-coding@users.noreply.github.com> Date: Sun, 20 Jul 2025 16:59:54 -0600 Subject: [PATCH 33/33] Update meson.build --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 298a4e6..09a34f4 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('Fossil IO', 'c', 'cpp', meson_version: '>=1.3.0', license: 'MPL-2.0', - version: '0.2.1', + version: '0.2.2', default_options: ['c_std=c17,c18', 'cpp_std=c++20']) subdir('code')