seq-compiler 5.4.0

Compiler for the Seq programming language
Documentation
# FFI Manifest for libedit (BSD-licensed readline alternative)
#
# Provides line-editing and history functionality for interactive programs.
# This is the BSD-licensed alternative to GNU readline, used by PostgreSQL,
# Python (on macOS), and many other projects.
#
# Installation:
#   macOS: Already installed (Apple ships libedit)
#   Ubuntu/Debian: apt install libedit-dev
#   Fedora: dnf install libedit-devel
#
# Usage in Seq:
#   include ffi:libedit
#
#   "prompt> " readline  # Read a line with editing
#   dup add-history      # Add to history
#
# Persistent history:
#   "/path/to/history" read-history drop   # Load at startup
#   # ... run REPL ...
#   "/path/to/history" write-history drop  # Save at exit
#
# Note: These functions accept file paths as-is. Shell expansions like ~
# are not performed - that's the responsibility of your application.
# A future std:os module could provide getenv for building paths like
# "$HOME/.myapp_history".
#
# Note: The function names (readline, add-history) match GNU readline's API,
# making it easy to switch between the two libraries.

[[library]]
name = "libedit"
link = "edit"

[[library.function]]
c_name = "readline"
seq_name = "readline"
stack_effect = "( String -- String )"
args = [
  { type = "string", pass = "c_string" }
]
[library.function.return]
type = "string"
ownership = "caller_frees"

[[library.function]]
c_name = "add_history"
seq_name = "add-history"
stack_effect = "( String -- )"
args = [
  { type = "string", pass = "c_string" }
]
[library.function.return]
type = "void"

# read_history(const char *filename) -> int
# Loads command history from a file. Call at program startup.
# Returns 0 on success, non-zero on error (e.g., file not found).
[[library.function]]
c_name = "read_history"
seq_name = "read-history"
stack_effect = "( String -- Int )"
args = [
  { type = "string", pass = "c_string" }
]
[library.function.return]
type = "int"

# write_history(const char *filename) -> int
# Saves command history to a file. Call at program exit.
# Returns 0 on success, non-zero on error.
[[library.function]]
c_name = "write_history"
seq_name = "write-history"
stack_effect = "( String -- Int )"
args = [
  { type = "string", pass = "c_string" }
]
[library.function.return]
type = "int"