Commit graph

58 commits

Author SHA1 Message Date
Yucong Sun
89060c5a6b
docs: fully-expandable generated sidebar + Chinese docs via Docusaurus i18n (#1246)
* docs: fully-expandable generated sidebar, replacing index.md link pages

Rework docs navigation so the sidebar expands to every page of every
reference tree, instead of terminating at generated index.md link lists:

- New docs/gen_sidebar.py (replaces gen_index.py + update_index.sh):
  walks efun/, apply/, stdlib/, concepts/, driver/, cli/ and zh-CN/ and
  emits sidebars.generated.json — a full Docusaurus category tree per
  directory. Category landing pages are now `generated-index` card pages
  (title/description/slug), so all generated index.md files are deleted.
  --check mode verifies freshness; new .github/workflows/docs-sidebar.yml
  runs it in CI.
- New docs/sidebar_meta.json holds curated presentation: category labels,
  one-line descriptions (shown on the landing cards), explicit ordering
  (driver/cli/concepts read top-down from user-facing to internals) and
  per-page label overrides.
- sidebars.ts becomes a hand-authored skeleton (Getting Started, lpc/,
  Historical) that splices in the generated trees.

Content reorganization (from a docs-wide review):
- Move misplaced efun pages out of efun/general: terminal/protocol efuns
  (act_mxp, send_zmp, request_term_*) to interactive/, debugging efuns
  (check_memory, dump_*, clear_debug_level, destructed_objects) to
  internals/, shallow_inherit_list to system/.
- Delete stub duplicates superseded by complete pages elsewhere:
  general/parse_{add_synonym,dump,my_rules,remove}, contrib/{shuffle,
  element_of}.

Modernize key pages with MDX:
- index.mdx: landing page with a card grid linking each doc section.
- build.mdx: per-platform <Tabs> (Ubuntu/macOS/Windows/Alpine+Docker),
  admonitions, VitePress [[toc]] leftover removed, stale per-platform CI
  workflow links updated to the unified ci.yml.
- ffi-plan.md: GitHub-style [!CAUTION] alert converted to an admonition.

`npm run build` passes clean (onBrokenLinks: throw, no warnings).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0174GM2azvAHBmvyESwxm5om

* docs: serve the Chinese corpus through Docusaurus i18n

Move the zh-CN/ directory out of the default docs tree and into a proper
Docusaurus locale (i18n/zh-CN/docusaurus-plugin-content-docs/current/):

- The flat zh-CN/efun/ directory (333 pages) is re-homed to mirror the
  categorized English layout (name-matched 1:1; `hash` maps to strings/
  per its own frontmatter). apply/ pages map 1:1; the stray English-text
  zh-CN/apply/master/view_errors.md documents a MudOS-era apply that no
  longer exists in the driver and is dropped; stdlib/db/database_zh.md
  becomes the i18n translation of stdlib/db/database.md; the Chinese
  build guide becomes the translation of build.mdx.
- Untranslated pages automatically fall back to English content under
  /zh-CN/, so the whole site is navigable in either locale from the new
  navbar locale dropdown.
- Both locales share one sidebar. Generated sidebar items now carry
  stable `key` fields (the directory/doc path) so translation keys are
  unique (both efun/ and stdlib/ have an "Arrays" category, crypto and
  strings both document `hash`). Category labels, generated-index
  titles/descriptions, navbar and footer are translated in
  i18n/zh-CN/...; theme UI strings come from Docusaurus' bundled
  zh-Hans translations. Translated landing page at /zh-CN/.
- The "中文文档" sidebar section, the zh-CN tree in gen_sidebar.py /
  sidebar_meta.json, and its slice of sidebars.generated.json are gone.
- Relative .md-file links on pages that render in both locales break
  the localized build (the file->permalink map points at the localized
  copy), so concepts/, the two socket_*_option pages and the config.md
  generator now emit extension-less route links instead.
- zh interactive.md/objects.md get explicit slugs like their English
  counterparts (a doc named after its parent directory is otherwise a
  Docusaurus category-index doc, colliding with the generated-index
  route).

`npm run build` builds both locales clean (onBrokenLinks: throw).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0174GM2azvAHBmvyESwxm5om

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-11 17:20:25 -04:00
Claude
b0f61c3313 Preserve this_player() in resolve() and async_* callbacks (#1104)
resolve(), async_read(), async_write(), async_getdir() and
async_db_exec() ran their callbacks with no user context, so
this_player() returned 0 and input_to()/printf() were unusable there.

Follow the call_out() precedent: capture command_giver (ref-held) when
the request is registered and restore it around the callback, skipping
destructed objects, gated on the same 'this_player in call_out'
setting. The pending-request holders account for the new ref in the
DEBUGMALLOC walkers.

The new test registers callbacks from two different living objects and
asserts each callback sees its own registrant, which fails without the
per-request capture.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lv2Gw2AWqtyN3nNEgob1He
2026-07-11 14:56:46 -04:00
Yucong Sun
6a25f5fe9b
wasm: shrink the driver to ~0.8MB over the wire (33.5MB -> 3.5MB raw) (#1243)
The wasm binary was dominated by the stock 30MB ICU data archive; the
driver only reads break-iterator data from it. Also drops zlib and the
last TLS reference from the target, and turns off MCCP/compress there.

- build-deps.sh trims the ICU archive with icupkg to brkitr rules + the
  converter alias table (~780KB). ICU_DATA_FILTER_FILE cannot do this:
  it only applies when building ICU data from source, and the -src
  tarball ships a prebuilt .dat. Table charsets (GBK, Big5, ...) are
  gone on this target -- string_encode() etc. raise an LPC error; a new
  __WASM__ LPC predefine lets mudlibs and tests adapt, and ICU_KEEP
  re-adds charsets for mudlibs that need them.
- zlib is not linked on wasm at all: a global HAVE_ZLIB (defined on
  every other platform) now gates the core's gzip'd file support --
  compressed save_object degrades to a plain save, write_file flag 2
  raises an error, and read_file/restore_object use stdio instead of
  transparent gzopen. That also surfaced a latent bug: core used gz*
  but only got zlib transitively via the compress package/libtelnet,
  so native now links ZLIB::ZLIB explicitly.
- TLS is fully gone from the target: the one shared caller of the TLS
  interface (the sys_reload_tls efun) is excluded from the wasm efun
  table in core.spec (the fullspec is preprocessed with the TARGET
  compiler, so #ifndef __EMSCRIPTEN__ works there), which lets the
  net/tls_stub.cc shim be deleted outright. Websocket code was already
  native-only via the Transport split.
- compress package + MCCP are off on wasm (compressing a byte stream to
  a client on the same page wastes CPU and size).
- INITIAL_MEMORY 128MB -> 64MB now that the data segment is small.
- Deps prefix is ICU-only; CI/release cache keys bumped to -v3 with the
  zlib pin removed. Docs (build-wasm.md guide, driver/wasm.md cookbook,
  src/wasm/README.md, README, AGENTS, sys_reload_tls efun page)
  updated.

Result: fluffos.wasm 33.5MB -> 3.5MB raw, ~0.8MB brotli / ~1.0MB gzip;
the full LPC testsuite passes inside the wasm driver.


Claude-Session: https://claude.ai/code/session_01VVpphH3cgXyziRDCbjUVkb

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-11 13:12:44 -04:00
Claude
88b21f970b contrib: get_os_env()/set_os_env() with config allow-lists
LPC can now read and set OS environment variables -- the ask from the
dockerization discussion -- gated by two new colon-separated runtime
config allow-lists: 'allowed os environment variables' (readable) and
'writable os environment variables' (writable, implicitly readable).
Both default to empty, so nothing is accessible until the host
administrator opts specific names in. set_os_env(name) with no value
unsets. Windows uses _putenv_s.

Includes efun docs, index registration, regenerated config docs, and a
testsuite case exercising allow/deny/read/write/unset paths (the test
config allow-lists PATH read-only and FLUFFOS_TEST_RW read-write).

Fixes #1045

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016FMBJLkpkpVpZdz6PWzeWe
2026-07-11 00:58:09 -04:00
Yucong Sun
e6f0c377f8
wasm: run the full driver in the browser (Emscripten port) (#1231)
The driver cross-compiles to WebAssembly and runs a complete mudlib
inside a webpage: compiler, VM, all portable efun packages, and the
real telnet protocol layer -- the page is the telnet client, JavaScript
is the wire. The LPC testsuite passes inside the wasm driver (browser
and node).

Architecture (src/wasm/README.md):
- Transport interface (src/net/transport.h): each interactive_t owns an
  abstract byte pipe (write/flush/schedule_command/close). comm.cc and
  telnet.cc are transport-agnostic and compile unchanged on every
  target. Implementations select at link time: SocketTransport +
  WebsocketTransport (net/transport_libevent.cc, native) vs
  WasmConsoleTransport (src/wasm/comm_wasm.cc).
- Inverted event loop: the shared gametick/event core stays in
  backend.cc; backend_libevent.cc (blocking loop) vs
  src/wasm/backend_wasm.cc (page-driven fluffos_tick(now_ms), walltime
  priority queue, capped catch-up). Other per-target singletons (TLS,
  DNS resolver, crash handler) follow the same link-time pattern -- no
  #ifdef __EMSCRIPTEN__ in shared logic files.
- Mudlib rides in Emscripten's MEMFS via file_packager; driver file I/O
  needed zero changes.

jsbridge package (WASM only): js_eval() (sync), js_call() (async page
handlers with LPC callbacks), js_export() (page calls LPC via
Module.fluffos.callLPC, Promise-resolved on a later tick) -- fetch,
canvas/WebGL, storage, page UIs driving the game. Demo in
testsuite/command/jsdemo.lpc + the bundled web terminal.

Build/tooling: native-tools + wasm CMake presets (host codegen tools,
then cross build); tools/wasm/build-deps.sh (ICU + zlib cross-builds,
including the ICU genccode data quirk); tools/wasm/pack-mudlib.sh
(any mudlib + driver -> static web bundle, also works standalone from
the release zip); src/www/wasm/index.html (self-contained web terminal
with a minimal telnet client). On emsdk >= 3.1.57 the build uses native
wasm exceptions (-fwasm-exceptions); older toolchains fall back to
-sDISABLE_EXCEPTION_CATCHING=0.

CI/release: a wasm CI job (latest emsdk, deps cache keyed on resolved
emcc version) gates PRs on the LPC testsuite running inside the wasm
driver under node; release.yml ships fluffos-<version>-wasm.zip
(driver + web terminal + pack-mudlib.sh). Fixed a stale-predefine bug:
options.autogen.h now depends on packages.autogen.h + config.h.

Docs: docs/build-wasm.md (end-to-end workflow), docs/driver/wasm.md
(packer + jsbridge cookbook), docs/efun/jsbridge/*, README + AGENTS
updated. Testsuite files for optional packages guard themselves with
#ifdef __PACKAGE_*__.


Claude-Session: https://claude.ai/code/session_01VVpphH3cgXyziRDCbjUVkb

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-10 23:33:51 -04:00
Claude
6b5e875b54 vm: add 'display preload progress' runtime option
The boot-time preload loop unconditionally printed every file name,
letting errors scroll away between hundreds of progress lines. The new
option (default on, preserving current behavior) silences the per-file
listing when set to 0, leaving errors clearly visible.

Fixes #967

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016FMBJLkpkpVpZdz6PWzeWe
2026-07-10 10:26:58 -04:00
Yucong Sun
c914f03d66
Add local search and documentation guide for docs site (#1221)
* docs: add local full-text search and a contributor README

Add @easyops-cn/docusaurus-search-local to the Docusaurus site so the
docs get an offline search bar (index built at build time, no external
service). English and zh-CN pages are both indexed, and matched terms
are highlighted on the target page.

Add docs/README.md describing the Docusaurus setup, local dev/build
commands, search behavior, directory layout, and gotchas; exclude it
from the published site alongside CLAUDE.md. Point the root README's
docs/ entry at it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TSzcESzU9947zkGzQ6SMmE

* docs: remove dead framework leftovers, fix index generation, complete the nav

Delete the VitePress (.vitepress/) and Jekyll (_layouts/, css/) leftovers,
the one-shot migration scripts (fix_md_header.py, fix_seealso.py), and the
stale keywords.json snapshot; prune the matching .gitignore entries and
docusaurus exclude patterns.

Rewrite gen_index.py for Docusaurus: it emitted dead .html links and
legacy 'layout: doc' frontmatter, choked on non-markdown entries, and
dropped nested categories — regenerating an index would have broken it.
It now emits the extension-less links the site actually uses, links
nested category indexes (restoring apply/* on the zh-CN index), and
refuses to run on the docs root. Fix update_index.sh's copy-paste titles
(zh-CN efun/build were titled 'APPLY'), stop it clobbering the
hand-written lpc/index.md, and cover cli/. Regenerated indexes pick up
the missing driver/ffi-plan entry. add_missing_efuns.py now takes the
keywords.json path as an argument instead of requiring a stale copy.

Move CNAME and the Google site-verification file into static/ so they
actually reach the published build output.

Complete the sidebar: link the CLI category to cli/index and add the
missing portbind/symbol/generate_keywords pages, and expose the
previously orphaned stdlib section under Reference.

Promote onBrokenLinks to 'throw' now the build is warning-free, and drop
the empty Demo section from the landing page.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TSzcESzU9947zkGzQ6SMmE

* docs: strip legacy 'layout: doc' frontmatter from all pages

Mechanical sweep removing the Jekyll-era 'layout: doc' line from every
doc page's frontmatter (Docusaurus ignores it), and the matching line
from the templates in docs/CLAUDE.md so new pages don't reintroduce it.
No content changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TSzcESzU9947zkGzQ6SMmE

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-09 22:09:55 -04:00
Yucong Sun
3bd12c657e fix config md 2026-07-09 20:48:48 -04:00
Yucong Sun
fd705f0634 docs: reconcile FFI plan + preprocessor/diagnostics docs with implementation
Doc-only review pass checking every branch-authored doc against the
shipped code. Fixes where docs described intent rather than the result:

- docs/driver/ffi-plan.md (began life as a plan, drifted from the
  shipped package): ffi_status() returns a mapping, not mixed*;
  callbacks are implemented and in-scope (ffi_callback/_addr/_free added
  to the efun surface and moved out of "v2 deferred"); the DEBUGMALLOC
  section now describes the actual std::unordered_map + TAG_BUFFER scheme
  (no TAG_FFI / mark hook exists); valid_ffi gates load/symbol/prepare/
  callback; testing is the 20-file LPC suite + tools/ffi/test.py (there
  is no GTest fixture).
- docs/lpc/preprocessor/index.md: document the #warn directive.
- docs/lpc/diagnostics.md + preprocessor/pragma.md: show_error_context is
  a legacy flag that no longer changes clang-style compiler diagnostics
  (render_diagnostic ignores PRAGMA_ERROR_CONTEXT; only the runtime
  smart_log path still reads it).
- tools/lpc-syntax/README.md: test.mjs is 49 assertions, not 47.

Verified accurate, no change needed: AGENTS.md, testsuite/README.md,
compiler/internal/README.md, and the source-files / float / strings /
text_blocks / define / conditionals / inherit / include docs, sprintf %g,
and the tools/ffi + vscode READMEs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 20:48:48 -04:00
Yucong Sun
9be761aa00 package_ffi: foreign function interface for LPC (libffi), with callbacks
Fully implements the docs/driver/ffi-plan.md design. LPC can now load
native shared libraries, call C functions whose signatures are described
at runtime, manage native memory, pass in/out parameters, and expose LPC
function pointers to C as callbacks.

Package (src/packages/ffi, option PACKAGE_FFI ON, libffi via pkg-config):
- ffi_load/unload/symbol; ffi_prepare/ffi_call (ffi_prep_cif + ffi_call);
  ffi_alloc/free/sizeof/peek/address; ffi_read/write; ffi_struct_layout;
  ffi_callback/ffi_callback_addr/ffi_callback_free (libffi closures that
  re-enter the VM via safe_call_function_pointer); ffi_error/ffi_status.
- Buffers are the currency for all pointer/byte data; raw pointer VALUES
  (returned pointers, buffer/callback addresses) are ints. LPC strings
  are UTF-8-native and never implicitly marshalled -- a char* is a
  buffer the caller encoded (pinned by ffi_string.lpc).
- Native allocations are LPC buffers (GC-tracked); handle tables freed at
  shutdown (ffi_cleanup) and marked for DEBUGMALLOC (mark_ffi).

Security: master apply valid_ffi(op, arg, caller) gates every
load/symbol/prepare/callback (VALID_FFI added to the applies table); a
missing apply denies by default. Optional "ffi allowed libraries" config
allow-list (rc.cc + runtime_config.h + regenerated config.md, new
Security category). __PACKAGE_FFI__ predefine added.

tools/ffi/generate.py: turns a C header into LPC bindings (buffer params
for char*, optional --string-convenience UTF-8 overloads) plus a struct
layout include; reports+skips unsupported forms; --emit-json contract.
Dependency-free test.py.

Tests: 20 testsuite/single/tests/efuns/ffi_*.lpc (every efun, the qsort
callback round trip, the generated-bindings end-to-end path), guarded by
__PACKAGE_FFI__ with a libc-reachability probe. The efuns are VM-stack-
based, so the LPC testsuite is the surface -- libffi's call/closure paths
run there under ASan/UBSan and the per-file check_memory leak gate.

The clang RelWithDebInfo sanitizer caught an error()-unwind leak: both
ffi_prepare and ffi_callback allocated before a code_to_type() that can
error() -- now unique_ptr/custom-deleter owned (AGENTS.md section 4).

Verified: testsuite x3 (ASan Debug) + ctest 297, RelWithDebInfo suite x3
+ ctest 298, clang RelWithDebInfo sanitizer (leak-clean), tools/ffi
test.py.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 20:48:48 -04:00
Yucong Sun
ef4d6744b0 docs/ffi-plan: buffers throughout — no implicit string<->char* marshalling
LPC strings are UTF-8-native, so the FFI boundary must never auto-convert
a string to a C char* (it would impose UTF-8 on APIs expecting other
encodings and cannot carry arbitrary bytes / embedded NULs). Every
pointer and byte payload crosses as a buffer; the LPC caller does the
encoding explicitly with string_encode/string_decode, exactly like the
rest of the driver. Dropped the FFI_STRING type code (a char* is just an
FFI_POINTER buffer); ffi_call args are int|float|buffer only; added
ffi_peek to copy a returned foreign char* into an owned buffer; the
tools/ffi generator emits buffer params for char* (with an opt-in,
clearly-named string-convenience overload). Driver-mediated identifiers
(library path, symbol name) stay string, consistent with the file efuns.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 20:48:48 -04:00
Yucong Sun
b9e67f1d49 docs: add package_ffi design plan (libffi-based LPC FFI + tools/ffi)
Proposal for an OFF-by-default ffi package: dlopen/dlsym + libffi to
load native libs and call functions with runtime-described signatures,
native memory managed as ref-counted LPC buffers (no new svalue tag),
a mandatory valid_ffi master-apply security gate, and a tools/ffi
header->LPC bindings generator. Phased v1a/v1b/v2 with GTest + LPC +
generator tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 20:48:48 -04:00
Yucong Sun
48fe0e9b5a Grammar-driven lexical simplification; minimal token inventory
Lexical decisions move from lexer state into the grammar, where LALR
lookahead already disambiguates:
- Array/mapping opens ({ / ([ are ordinary '(' '{' / '(' '[' token
  pairs the grammar pairs (composite tokens deleted).
- The whole '(: name' first-class-function machinery (dedicated start
  condition, function_flag, one-byte peek, old_func()) becomes two
  grammar productions; %expect documents the intentional conflicts.
- Token diet: dead tokens deleted; single-char operators are plain char
  tokens ('!', '.'); same-precedence families share one value-carrying
  token (L_EQ_NE, L_SHIFT, L_INC_DEC -- the L_ORDER idiom). Release-
  build illegal-char diagnostics made unconditional; CRLF multi-line
  #define fold pinned (Windows).

Includes the merge of current master (docs-only advance).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 20:48:48 -04:00
Yucong Sun
2063e95436
Fix Docusaurus sidebar, broken links, and gh-pages CI (#1209)
* Reorder sidebar: Driver > CLI > Reference (LPC Language, Apply, EFUN, Concepts)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix Docusaurus build: broken links, duplicate routes, and gh-pages CI

- Strip .html from all markdown link targets (51 files) for Docusaurus URL routing
- Add slug: frontmatter to 4 files whose names match their parent directory
  (interactive.md, objects.md, README.md, build.md) to prevent Docusaurus's
  category-index convention from creating duplicate routes
- Fix one missed .html link in zh-CN/build/index.md
- Move onBrokenMarkdownLinks to markdown.hooks (Docusaurus v4 deprecation)
- Update gh-pages.yml: rename to Docusaurus, use node 22, correct build path
  (docs/build instead of docs/.vitepress/dist)

Build now completes with [SUCCESS] and zero warnings or broken links.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 21:01:21 -07:00
gesslar
e1a50d2642
Generate driver config docs and a starter config from rc.cc tables (#1206)
* Generate driver config docs and a starter config from rc.cc tables

Make the runtime-config option tables in rc.cc the single source of truth
for documentation, so the docs can no longer drift from the driver.

- rc.cc: add `category`/`description` fields to the int-option table
  (INT_FLAGS) and introduce a STR_FLAGS table for the simple string
  options, parsing them directly from the table in read_config().
- docs/gen_config_docs.py: generate docs/driver/config.md from those
  tables (resolving expression/macro defaults). `--check` mode fails if
  the committed doc is stale.
- .github/workflows/config-docs.yml: run the generator with --check on
  changes to rc.cc/options_internal.h/the generator/the doc.
- docs/driver/config.md: regenerated; now covers all recognized options
  accurately (previously ~half, with some stale/nonexistent entries).
- driver --generate-config: emit a complete, bootable starter config to
  stdout (ints at defaults, required paths as placeholders, websocket/
  TLS/external bits commented out). Comment lines are wrapped to stay
  under the parser's per-line limit.
- Config.example: add the 9 previously-missing options and fix the
  "call_out(0) next level" -> "nest level" typo.
- CLAUDE.md / docs/CLAUDE.md / docs/cli/driver.md: document the source of
  truth, the regeneration workflow, and the new flag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Config.example: keep only valid options

Remove options the driver doesn't actually use:
- obsolete (driver warns to delete): `binary directory`, `swap file`
- unrecognized / silently ignored: `apply cache bits`, `maximum users`,
  `compiler stack size`

Relocate `evaluator stack size` (a valid limit) up with the other limits
and drop the now-empty "not currently used or implemented" section, and
remove the `binary directory` mention from the header note.

Verified: the cleaned sample boots a mudlib to "Initializations complete"
with no obsolete-line warnings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 13:07:06 -04:00
gesslar
819a883c7f
Add nullish coalescing (??) and logical assignment operators (||=, &&=, ??=) (#1149)
* 11-12-adding_nullish_coalescing_operator: 2025-11-12 22:47 - nullish stuff

* 11-12-adding_nullish_coalescing_operator: 2025-11-12 23:28 - adding logical assignment operators

* adding autogen files because grammar has changed

* addressing Codex feedback

* Fix __TREE__ debug output for NODE_NULLISH and NODE_LOGICAL_ASSIGN

The lpc_tree_name array was missing entries for NODE_NULLISH and
NODE_LOGICAL_ASSIGN node types that were added when implementing
the nullish coalescing operator (??). This caused __TREE__ to return
incorrect type names in the debug output.

The fix adds the missing entries "nullish" and "logical assign" to
the lpc_tree_name array at the correct indices to match the parse node
enum definition, allowing the constant_expr.c test to pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* adding autogens

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-05 19:46:11 -08:00
Yucong Sun
ddf8b9740d
more doc fixes. (#1137)
* docs: Fix multiple documentation issues

This commit addresses several documentation inconsistencies and gaps
identified by comparing docs with actual code implementations:

**Build Documentation Fixes:**
- Updated macOS build instructions to clarify Homebrew paths for both
  Apple Silicon and Intel Macs, emphasizing modern Homebrew defaults
- Added clarity to SQLite version options (=1 vs =2) explaining the
  differences and recommending version 2

**CLI Tool Documentation:**
- Added documentation for the `symbol` utility (docs/cli/symbol.md)
  - Tool for loading and analyzing LPC files
  - Usage: symbol <config> lpc_file
- Added documentation for the `portbind` utility (docs/cli/portbind.md)
  - Privilege-separated port binding for FluffOS
  - Allows binding to privileged ports then dropping privileges

**Apply Documentation:**
- Added mxp_enable apply (docs/apply/interactive/mxp_enable.md)
  - Called when MXP protocol is negotiated with client
- Added mxp_tag apply (docs/apply/interactive/mxp_tag.md)
  - Processes MXP tags from client
- Added zmp_command apply (docs/apply/interactive/zmp.md)
  - Handles ZMP (Zenith Mud Protocol) commands
- Added receive_ed apply (docs/apply/interactive/receive_ed.md)
  - Post-processes ed editor output
- Removed obsolete view_errors.md documentation
  - Apply not found in source code, appears to be deprecated

All new documentation follows existing format conventions and includes
cross-references to related efuns and applies where applicable.

* docs: Add missing apply and efun documentation

This commit adds documentation for previously undocumented applies and
efuns, completing the documentation coverage for recent FluffOS features.

**Apply Documentation:**
- terminal_colour_replace (interactive): Custom color token replacement
  callback for terminal_colour() efun preprocessing
- parser_error_message (master): Custom error message generation for
  parse_sentence() failures

**Efun Documentation:**
- hash() (crypto package): Complete documentation for cryptographic hash
  function with support for modern algorithms (SHA-3, BLAKE2, SM3)
  - Includes security recommendations and version compatibility notes
  - Documents all supported algorithms from legacy (MD5, SHA-1) to modern
    (SHA-3, BLAKE2b512)
  - Created new crypto package documentation directory

**Index Updates:**
- Updated docs/apply/interactive/index.md with new applies:
  mxp_enable, mxp_tag, receive_ed, terminal_colour_replace, zmp
- Updated docs/apply/master/index.md with parser_error_message
- Removed obsolete view_errors reference from master index
- Added crypto section to docs/efun/index.md

These additions address documentation gaps identified by comparing the
source code with existing documentation, particularly for the crypto
package enhancements from commit 33de35c (modern hash algorithms).

* docs: Add CLI tool, config guide, and documentation maintenance guide

This commit adds comprehensive documentation for additional FluffOS
features and creates a maintenance guide for the documentation itself.

**New CLI Documentation:**
- generate_keywords: Development tool for generating keywords.json for IDE
  integration and language server support. Extracts all efun metadata into
  structured JSON format.

**New Configuration Documentation:**
- config.md (driver/): Complete guide to driver configuration file format
  - Documents all configuration options with examples
  - Network setup (telnet, websocket, TLS)
  - Memory management and performance tuning
  - Protocol support (GMCP, MXP, ZMP, MSSP, MSP)
  - Security settings and limits
  - Includes practical examples for development and production

**Documentation Maintenance Guide:**
- CLAUDE.md (docs/): Comprehensive guide for maintaining FluffOS documentation
  - Documentation structure and organization
  - Templates for applies, efuns, and CLI tools
  - Workflow for finding and documenting undocumented features
  - Source code mapping (where to find implementations)
  - Verification and testing procedures
  - Common documentation issues and fixes
  - Package-specific notes and guidelines
  - Quick reference commands for contributors

**Index Updates:**
- Updated docs/driver/index.md to include config.md

These additions make it easier for contributors and AI assistants to
maintain accurate, complete documentation for FluffOS.

* docs: Add socket TLS options and LPC default arguments documentation

This commit documents important FluffOS features that were previously
undocumented, focusing on TLS socket options and LPC language enhancements.

**Socket TLS Options Documentation:**
- socket_set_option() efun - Configure socket TLS/SSL parameters
  - SO_TLS_VERIFY_PEER: Control peer certificate verification
  - SO_TLS_SNI_HOSTNAME: Set Server Name Indication hostname
  - Includes security notes and practical examples
  - Essential for HTTPS and secure socket connections

- socket_get_option() efun - Query socket option values
  - Retrieve TLS verification and SNI settings
  - Useful for validation and debugging
  - Examples for conditional logic and auditing

**LPC Language Feature:**
- Default Arguments documentation (prototypes.md)
  - Comprehensive guide to FluffOS default argument syntax
  - Feature added in commit bcb8e91 (2023) but not documented
  - Rules, examples, and use cases
  - Multiple practical examples showing API design patterns
  - Notes on compile-time behavior and limitations

**Index Updates:**
- Updated docs/efun/index.md with new socket functions
- Updated docs/efun/sockets/index.md with new functions

These features significantly enhance LPC programming capabilities:
1. TLS options enable secure network connections with certificate verification
2. Default arguments reduce code duplication and improve API usability

Both features are production-ready and widely used but were missing
from the documentation.

References:
- Socket options: commit 1fd7f61 (2023)
- Default arguments: commit bcb8e91 (2023)

* docs: Add comprehensive guides for tracing, TLS, and WebSocket support

Added three new concept documentation guides:

1. tracing.md - Complete guide to performance profiling with trace_start/trace_end
   - Chrome DevTools integration
   - Memory management warnings
   - Profiling scenarios (commands, combat, heartbeats)
   - Analysis techniques and best practices

2. tls.md - Comprehensive TLS/SSL support documentation
   - Server port TLS configuration
   - Certificate generation (self-signed and Let's Encrypt)
   - Client TLS socket connections with SO_TLS_VERIFY_PEER and SO_TLS_SNI_HOSTNAME
   - Security best practices
   - Troubleshooting guide

3. websocket.md - Complete WebSocket support guide
   - WebSocket server configuration (ws:// and wss://)
   - Multiple protocols (ASCII, Telnet, Binary, HTTP)
   - Built-in web client documentation and customization
   - GMCP over WebSocket
   - Telnet protocol over WebSocket
   - Security considerations and performance optimization
   - Troubleshooting and advanced usage

Updated concepts/general/index.md to include all three new guides.

* docs: Regenerate documentation indices

Ran update_index.sh to regenerate all documentation indices:

- docs/apply/index.md: Added new applies (mxp_enable, mxp_tag, receive_ed,
  terminal_colour_replace, zmp, parser_error_message), removed obsolete view_errors

- docs/concepts/index.md: Added new concept guides (tls, tracing, websocket)

- docs/driver/index.md: Added config documentation, updated title format

- docs/efun/crypto/index.md: Regenerated to standard format with hash function

- docs/cli/index.md: Generated index for CLI tools (driver, generate_keywords,
  json2o, lpcc, o2json, portbind, symbol)

All indices now correctly reference the new documentation added in previous commits.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-31 14:25:38 -07:00
Yucong Sun
34cf7bcc68
fix memory corruption issue (#1035) 2023-12-26 00:07:10 -08:00
Yucong Sun
6d8698a09d setup vitepress 2023-12-02 20:00:33 -08:00
Michael Programs
f7802e218d run docs update_index.sh 2023-08-21 23:38:33 -07:00
Yucong Sun
3bca73af50 EFUN: sys_reload_tls(int port_index) 2023-05-29 21:15:09 -07:00
Yucong Sun
3478cc2ed6 EFUN: time_ns() 2023-05-29 11:09:09 -07:00
噢哎哟喂
c0b196c0d6
更新说明文档 (#897)
* 更新说明文档

* update README.md

* update efun docs

* update efun docs, add parsing efun

* 修复network_stats()中文文档错误
2022-07-07 18:39:06 -07:00
Yucong Sun
3093d818e5 Update doc index 2022-05-07 14:04:12 -07:00
噢哎哟喂
44532e0228
add DB, update docs (#807)
* add DB

* update docs

* update DB

* add database code

* update docs
2021-05-09 06:35:59 -07:00
噢哎哟喂
2d2f3c94ee
update zh-CN docs (#801) 2021-04-23 02:35:04 -04:00
jalbright015
cb1faea2f5
Updated documentation for clone_object() and new() efuns (#794)
* Updated documentation for clone_object() and new() efuns

* Updated documentation index

* Updating documentation for new() and clone_object() efuns
2021-04-17 21:57:47 -04:00
jalbright015
b13f0ebd9d
Added perf_counter_ns() documentation (#792)
* Added documentation for defer() efun

* Updated index to reflect defer() documentation

* Added documentation for new efun perf_counter_ns()

* Updated index to reflect perf_counter_ns() documentation

* Added documentation for new efun perf_counter_ns()

* Updated index to reflect perf_counter_ns() documentation
2021-04-16 13:27:16 -04:00
jalbright015
69351d52e6
Added documentation for defer() efun (#791)
* Added documentation for defer() efun

* Updated index to reflect defer() documentation
2021-04-16 11:36:23 -04:00
Yucong Sun
c20ca9a15e Update doc index 2021-04-11 01:45:36 +08:00
Yucong Sun
5eafddf8bb
stdlib: base64encode/base64decode from Gesslar (#770)
* new sefuns base64encode, base64decode

* update docs

* stdlib: base64encode/base64decode

Co-authored-by: Brian Workman <bworkman@frogdice.com>
2021-03-25 05:43:16 +08:00
Yucong Sun
868d2db57b EFUN: strptime() and strftime() 2021-02-23 17:58:02 -08:00
Yucong Sun
f395a8884d fix build errors 2020-12-13 18:10:32 -08:00
Yucong Sun
42b286f067 Some cleanup on the docs 2020-12-10 18:35:31 -08:00
Yucong Sun
f9531c05cc cleanup doc index generation, upgrade to python3 2020-12-10 18:35:31 -08:00
oiuv
e836be493c update docs 2020-12-06 09:49:10 -08:00
Yucong Sun
0650d9e73b Adding EFUN pcre_match_all 2020-11-10 13:36:29 -08:00
Yucong Sun
53e789890f Update doc 2020-11-10 13:36:29 -08:00
oiuv
5023af8875 update docs 2020-10-31 23:38:58 +08:00
Yucong Sun
1c622e5ba4 Upgrade backward-cpp 2020-10-11 18:46:33 -07:00
Yucong Sun
ae71e49c60 apply: virtual_start() for virtual objects 2020-08-25 20:46:10 -07:00
Yucong Sun
553e97ee97 Adding efun: telnet_nop() 2020-08-20 00:11:40 -07:00
Yucong Sun
6833890533 Implement secure_random() efun 2020-07-23 00:18:24 -07:00
oiuv
8b7baa7fb9 update docs 2020-05-09 09:35:19 -07:00
Yucong Sun
c441f67241 Improve documentation 2020-05-01 09:04:02 -07:00
Yucong Sun
34f226a938 Adding an VMTracer that could output to chrome devtools 2020-04-13 23:25:27 -07:00
噢哎哟喂
294cf88049
update docs,fix lpcc (#615)
* update rouge.css

* update build.md

* fix lpcc

* update docs

* update index
2020-03-19 08:56:48 -07:00
oiuv
5d71ec806b update docs 2020-03-18 07:48:45 -07:00
Yucong Sun
0e00716be6 Fix issue in gen_index.py 2020-03-14 20:50:00 -07:00
Yucong Sun
0a5ebfd371 more doc website fix 2020-03-12 02:35:52 -07:00