1
0
Fork 0
forked from fun/fun

Removed all libsql support. (0.40.4)

This commit is contained in:
Johannes Findeisen 2026-04-03 19:10:15 +02:00
commit 74a003236d
13 changed files with 6 additions and 226 deletions

View file

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
project(fun VERSION 0.40.3 LANGUAGES C) project(fun VERSION 0.40.4 LANGUAGES C)
set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD_REQUIRED ON)

View file

@ -17,7 +17,6 @@ include(${CMAKE_SOURCE_DIR}/cmake/Extensions/PCSC.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/Extensions/JSON.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Extensions/JSON.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/Extensions/INI.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Extensions/INI.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/Extensions/XML2.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Extensions/XML2.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/Extensions/LIBSQL.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/Extensions/PCRE2.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Extensions/PCRE2.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/Extensions/CURL.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Extensions/CURL.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/Extensions/REPL.cmake) include(${CMAKE_SOURCE_DIR}/cmake/Extensions/REPL.cmake)
@ -31,7 +30,7 @@ _fun_print_feature("PCSC (FUN_WITH_PCSC)" FUN_WITH_PCSC)
_fun_print_feature("JSON-C (FUN_WITH_JSON)" FUN_WITH_JSON) _fun_print_feature("JSON-C (FUN_WITH_JSON)" FUN_WITH_JSON)
_fun_print_feature("INI/iniparser (FUN_WITH_INI)" FUN_WITH_INI) _fun_print_feature("INI/iniparser (FUN_WITH_INI)" FUN_WITH_INI)
_fun_print_feature("libxml2 (FUN_WITH_XML2)" FUN_WITH_XML2) _fun_print_feature("libxml2 (FUN_WITH_XML2)" FUN_WITH_XML2)
_fun_print_feature("libsql (FUN_WITH_LIBSQL)" FUN_WITH_LIBSQL) ## libsql extension removed
_fun_print_feature("PCRE2 (FUN_WITH_PCRE2)" FUN_WITH_PCRE2) _fun_print_feature("PCRE2 (FUN_WITH_PCRE2)" FUN_WITH_PCRE2)
_fun_print_feature("libcurl (FUN_WITH_CURL)" FUN_WITH_CURL) _fun_print_feature("libcurl (FUN_WITH_CURL)" FUN_WITH_CURL)
_fun_print_feature("REPL (FUN_WITH_REPL)" FUN_WITH_REPL) _fun_print_feature("REPL (FUN_WITH_REPL)" FUN_WITH_REPL)

View file

@ -47,7 +47,7 @@ This file serves as an index of the documents in this directory. Links are relat
Documentation for optional, build-time selectable integrations lives in [external/](./external/): Documentation for optional, build-time selectable integrations lives in [external/](./external/):
- [Index of extensions](./external/README.md) - [Index of extensions](./external/README.md)
- Highlights: [cURL](./external/curl.md), [INI](./external/ini.md), [JSON](./external/json.md), [XML (libxml2)](./external/xml2.md), [SQLite](./external/sqlite.md), [libSQL](./external/libsql.md), [PCRE2](./external/pcre2.md), [PC/SC](./external/pcsc.md), [Notcurses](./external/notcurses.md), [Tcl/Tk](./external/tcltk.md), [OpenSSL](./external/openssl.md) - Highlights: [cURL](./external/curl.md), [INI](./external/ini.md), [JSON](./external/json.md), [XML (libxml2)](./external/xml2.md), [SQLite](./external/sqlite.md), [PCRE2](./external/pcre2.md), [PC/SC](./external/pcsc.md), [Tcl/Tk](./external/tcltk.md), [OpenSSL](./external/openssl.md)
## Tips ## Tips

View file

@ -13,13 +13,10 @@ This section documents Fun's optional, build-time selectable extensions. Each pa
- [JSON (json-c)](./json.md) - [JSON (json-c)](./json.md)
- [libxml2 (XML)](./xml2.md) - [libxml2 (XML)](./xml2.md)
- [SQLite](./sqlite.md) - [SQLite](./sqlite.md)
- [libSQL (SQLite-compatible)](./libsql.md)
- [PCRE2 (Perl-compatible regex)](./pcre2.md) - [PCRE2 (Perl-compatible regex)](./pcre2.md)
- [PC/SC (Smart cards)](./pcsc.md) - [PC/SC (Smart cards)](./pcsc.md)
- [Notcurses (TUI)](./notcurses.md)
- [Tcl/Tk (GUI)](./tcltk.md) - [Tcl/Tk (GUI)](./tcltk.md)
- [OpenSSL](./openssl.md) - [OpenSSL](./openssl.md)
- [LibreSSL](./libressl.md)
## Notes: ## Notes:

View file

@ -1 +0,0 @@
This page has been removed. LibreSSL integration was dropped from the Fun project, along with related examples and build options.

View file

@ -1,17 +0,0 @@
# libSQL extension (optional)
- CMake option: FUN_WITH_LIBSQL=ON
- Purpose: SQLite-compatible client using the libSQL (Turso) library.
- Homepage: https://libsql.org/
## Opcodes:
- OP_LIBSQL_OPEN: pops url_or_path; pushes handle (>0) or 0
- OP_LIBSQL_CLOSE: pops handle; pushes Nil
- OP_LIBSQL_EXEC: pops sql, handle; pushes rc:int (0=OK)
- OP_LIBSQL_QUERY: pops sql, handle; pushes array<map>
## Notes:
- Uses a SQLite-compatible C API provided by libSQL; behavior is similar to the SQLite backend.
- This module is independent from the SQLite extension; you may enable either or both.

View file

@ -1,27 +0,0 @@
# Notcurses (TUI) extension (optional)
- CMake option: FUN_WITH_NOTCURSES=ON
- Purpose: Terminal UI capabilities via the Notcurses library.
- Homepage: https://notcurses.com/
## Opcodes:
- OP_NC_INIT: initialize Notcurses; returns 1 on success, 0 on failure
- OP_NC_SHUTDOWN: shutdown; returns 0
- OP_NC_CLEAR: clear screen/plane; returns 0
- OP_NC_DRAW_TEXT: pops text, x, y; draws; returns 0
- OP_NC_GETCH: pops timeout_ms; returns codepoint or -1 on timeout/error
- OP_NC_GET_SIZE: push [rows, cols] of the stdplane, or -1 if unavailable
- OP_NC_SET_STYLE: pops style, bg_rgb, fg_rgb; sets colors/styles for stdplane; returns 0/-1
- OP_NC_DRAW_CHAR: pops ch, x, y; draws a single Unicode codepoint; returns 0/-1
- OP_NC_DRAW_HLINE: pops len, x, y, ch; draws a horizontal line; returns 0/-1
- OP_NC_DRAW_VLINE: pops len, x, y, ch; draws a vertical line; returns 0/-1
- OP_NC_BOX: pops x, y, w, h, style; draws a rectangle using ASCII/Unicode box glyphs; returns 0/-1
- OP_NC_FILL: pops x, y, w, h, ch; fills an area with a codepoint; returns 0/-1
- OP_NC_RENDER: forces a render; returns 0/-1
## Notes:
- Requires Notcurses development headers/libs.
- Behavior may vary across terminals; see the implementation for details.
- When Fun is built without Notcurses (FUN_WITH_NOTCURSES=OFF), these opcodes still exist but perform no-ops and return -1/0 as documented, allowing scripts to degrade gracefully.

View file

@ -157,12 +157,7 @@ This document provides an overview of the available VM opcodes implemented under
- OP_SQLITE_EXEC: Execute statement; pops handle:int, sql:string; pushes rc:int (0=OK). - OP_SQLITE_EXEC: Execute statement; pops handle:int, sql:string; pushes rc:int (0=OK).
- OP_SQLITE_QUERY: Run query; pops handle:int, sql:string; pushes array<map<string,any>>. - OP_SQLITE_QUERY: Run query; pops handle:int, sql:string; pushes array<map<string,any>>.
## libSQL <!-- libSQL opcodes removed -->
- OP_LIBSQL_OPEN: Open database (url or path); pops string; pushes handle (>0) or 0.
- OP_LIBSQL_CLOSE: Close database; pops handle; pushes Nil.
- OP_LIBSQL_EXEC: Execute statement; pops handle:int, sql:string; pushes rc:int (0=OK).
- OP_LIBSQL_QUERY: Run query; pops handle:int, sql:string; pushes array<map<string,any>>.
## OS, Time, Processes, Threads, Sockets, Serial ## OS, Time, Processes, Threads, Sockets, Serial
@ -245,9 +240,7 @@ This document provides an overview of the available VM opcodes implemented under
- OP_NC_FILL: Fill rectangle with codepoint; pops x:int, y:int, w:int, h:int, ch:int; pushes 0/-1. - OP_NC_FILL: Fill rectangle with codepoint; pops x:int, y:int, w:int, h:int, ch:int; pushes 0/-1.
- OP_NC_RENDER: Force a render; pushes 0/-1. - OP_NC_RENDER: Force a render; pushes 0/-1.
## SQLite-compatible lib (libSQL) <!-- libSQL backend removed -->
- See “libSQL” section above; identical opcode set with different backend.
## TK (Tcl/Tk UI) ## TK (Tcl/Tk UI)

View file

@ -1,59 +0,0 @@
#!/usr/bin/env fun
/*
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
* Copyright 2025 Johannes Findeisen <you@hanez.org>
* Licensed under the terms of the Apache-2.0 license.
* https://opensource.org/license/apache-2-0
*
* Added: 2025-11-26
*/
// Demonstrates the optional libSQL extension
// Build with: cmake -S . -B build -DFUN_WITH_LIBSQL=ON && cmake --build build
// Prepare sample DB from SQL if needed (requires sqlite3 CLI installed)
// Create it once with:
// sqlite3 ./database.sqlite < ./examples/data/database.sql
number h = libsql_open("./database.sqlite")
if h == 0
print("Failed to open libSQL database")
else
libsql_exec(h, "CREATE TABLE IF NOT EXISTS todos(id INTEGER PRIMARY KEY, title TEXT, done INT)")
libsql_exec(h, "DELETE FROM todos")
libsql_exec(h, "INSERT INTO todos(title, done) VALUES('Buy milk', 0)")
libsql_exec(h, "INSERT INTO todos(title, done) VALUES('Write code', 1)")
rows = libsql_query(h, "SELECT id, title, done FROM todos ORDER BY id")
for row in rows
print(to_string(row["id"]) + ": " + to_string(row["title"]) + " (done="+to_string(row["done"]) + ")")
rows = libsql_query(h, "SELECT id, title, done, created_at FROM tasks ORDER BY id;")
print("Tasks (" + to_string(len(rows)) + "):")
for row in rows
string status = ""
if row["done"] == 1
status = ""
print("- [" + status + "] (#" + to_string(row["id"]) + ") " + to_string(row["title"]) + " " + to_string(row["created_at"]))
number rc = libsql_exec(h, "INSERT INTO tasks (title, done) VALUES ('Try Fun + SQLite', 0);")
print("Insert rc=" + to_string(rc))
rows2 = libsql_query(h, "SELECT count(*) AS cnt FROM tasks;")
print("Total tasks now: " + to_string(rows2[0]["cnt"]))
libsql_close(h)
/* Example output:
1: Buy milk (done=0)
2: Write code (done=1)
Tasks (3):
- [✔] (#1) Write Fun + SQLite example 2025-11-26 23:20:41
- [✘] (#2) Ship optional feature flag 2025-11-26 23:20:41
- [✘] (#3) Celebrate with coffee 2025-11-26 23:20:41
Insert rc=0
Total tasks now: 4
*/

View file

@ -257,14 +257,6 @@ static const char *opcode_name(OpCode op) {
return "SQLITE_EXEC"; return "SQLITE_EXEC";
case OP_SQLITE_QUERY: case OP_SQLITE_QUERY:
return "SQLITE_QUERY"; return "SQLITE_QUERY";
case OP_LIBSQL_OPEN:
return "LIBSQL_OPEN";
case OP_LIBSQL_CLOSE:
return "LIBSQL_CLOSE";
case OP_LIBSQL_EXEC:
return "LIBSQL_EXEC";
case OP_LIBSQL_QUERY:
return "LIBSQL_QUERY";
case OP_PCSC_ESTABLISH: case OP_PCSC_ESTABLISH:
return "PCSC_ESTABLISH"; return "PCSC_ESTABLISH";
case OP_PCSC_RELEASE: case OP_PCSC_RELEASE:

View file

@ -162,11 +162,6 @@ typedef enum {
OP_SQLITE_EXEC, // pops sql, handle; pushes sqlite rc (0=OK) OP_SQLITE_EXEC, // pops sql, handle; pushes sqlite rc (0=OK)
OP_SQLITE_QUERY, // pops sql, handle; pushes array<map> OP_SQLITE_QUERY, // pops sql, handle; pushes array<map>
// libsql (optional, independent)
OP_LIBSQL_OPEN, // pops url/path; pushes handle (>0) or 0
OP_LIBSQL_CLOSE, // pops handle; pushes Nil
OP_LIBSQL_EXEC, // pops sql, handle; pushes rc (0=OK)
OP_LIBSQL_QUERY, // pops sql, handle; pushes array<map>
// PCSC (smart card) opcodes // PCSC (smart card) opcodes
OP_PCSC_ESTABLISH, // returns context id (>0) or 0 OP_PCSC_ESTABLISH, // returns context id (>0) or 0

View file

@ -2093,91 +2093,6 @@ static int emit_primary(Bytecode *bc, const char *src, size_t len, size_t *pos)
free(name); free(name);
return 1; return 1;
} }
/* libsql builtins (independent extension) */
if (strcmp(name, "libsql_open") == 0) {
(*pos)++; /* '(' */
if (!emit_expression(bc, src, len, pos)) {
parser_fail(*pos, "libsql_open expects (url_or_path)");
free(name);
return 0;
}
if (!consume_char(src, len, pos, ')')) {
parser_fail(*pos, "Expected ')' after libsql_open arg");
free(name);
return 0;
}
bytecode_add_instruction(bc, OP_LIBSQL_OPEN, 0);
free(name);
return 1;
}
if (strcmp(name, "libsql_close") == 0) {
(*pos)++; /* '(' */
if (!emit_expression(bc, src, len, pos)) {
parser_fail(*pos, "libsql_close expects (handle)");
free(name);
return 0;
}
if (!consume_char(src, len, pos, ')')) {
parser_fail(*pos, "Expected ')' after libsql_close arg");
free(name);
return 0;
}
bytecode_add_instruction(bc, OP_LIBSQL_CLOSE, 0);
free(name);
return 1;
}
if (strcmp(name, "libsql_exec") == 0) {
(*pos)++; /* '(' */
if (!emit_expression(bc, src, len, pos)) {
parser_fail(*pos, "libsql_exec expects (handle, sql)");
free(name);
return 0;
}
if (!consume_char(src, len, pos, ',')) {
parser_fail(*pos, "libsql_exec expects (handle, sql)");
free(name);
return 0;
}
if (!emit_expression(bc, src, len, pos)) {
parser_fail(*pos, "libsql_exec expects (handle, sql)");
free(name);
return 0;
}
if (!consume_char(src, len, pos, ')')) {
parser_fail(*pos, "Expected ')' after libsql_exec args");
free(name);
return 0;
}
bytecode_add_instruction(bc, OP_LIBSQL_EXEC, 0);
free(name);
return 1;
}
if (strcmp(name, "libsql_query") == 0) {
(*pos)++; /* '(' */
if (!emit_expression(bc, src, len, pos)) {
parser_fail(*pos, "libsql_query expects (handle, sql)");
free(name);
return 0;
}
if (!consume_char(src, len, pos, ',')) {
parser_fail(*pos, "libsql_query expects (handle, sql)");
free(name);
return 0;
}
if (!emit_expression(bc, src, len, pos)) {
parser_fail(*pos, "libsql_query expects (handle, sql)");
free(name);
return 0;
}
if (!consume_char(src, len, pos, ')')) {
parser_fail(*pos, "Expected ')' after libsql_query args");
free(name);
return 0;
}
bytecode_add_instruction(bc, OP_LIBSQL_QUERY, 0);
free(name);
return 1;
}
if (strcmp(name, "curl_post") == 0) { if (strcmp(name, "curl_post") == 0) {
(*pos)++; /* '(' */ (*pos)++; /* '(' */
if (!emit_expression(bc, src, len, pos)) { if (!emit_expression(bc, src, len, pos)) {

View file

@ -65,7 +65,6 @@
/* Note: INI opcode handlers are included below; changes in vm/ini/ .c files /* Note: INI opcode handlers are included below; changes in vm/ini/ .c files
* require vm.c to rebuild. */ * require vm.c to rebuild. */
#include "external/json.c" #include "external/json.c"
#include "external/libsql.c"
#include "external/openssl.c" #include "external/openssl.c"
#include "external/pcre2.c" #include "external/pcre2.c"
#include "external/pcsc.c" #include "external/pcsc.c"
@ -884,13 +883,7 @@ void vm_run(VM *vm, Bytecode *entry) {
} }
#endif #endif
/* libsql ops (independent) */ /* libsql support removed */
#ifdef FUN_WITH_LIBSQL
#include "vm/libsql/close.c"
#include "vm/libsql/exec.c"
#include "vm/libsql/open.c"
#include "vm/libsql/query.c"
#endif
/* PCRE2 ops */ /* PCRE2 ops */
#ifdef FUN_WITH_PCRE2 #ifdef FUN_WITH_PCRE2